Skip to content

Commit cc675d2

Browse files
committed
Merge tag 'for-linus-6.1-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip
Pull xen fixes from Juergen Gross: "Two trivial cleanups, and three simple fixes" * tag 'for-linus-6.1-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen/platform-pci: use define instead of literal number xen/platform-pci: add missing free_irq() in error path xen-pciback: Allow setting PCI_MSIX_FLAGS_MASKALL too xen/pcpu: fix possible memory leak in register_pcpu() x86/xen: Use kstrtobool() instead of strtobool()
2 parents 31c9c4c + 4abb77f commit cc675d2

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

arch/x86/xen/enlighten_pv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <linux/start_kernel.h>
2424
#include <linux/sched.h>
2525
#include <linux/kprobes.h>
26+
#include <linux/kstrtox.h>
2627
#include <linux/memblock.h>
2728
#include <linux/export.h>
2829
#include <linux/mm.h>
@@ -113,7 +114,7 @@ static __read_mostly bool xen_msr_safe = IS_ENABLED(CONFIG_XEN_PV_MSR_SAFE);
113114
static int __init parse_xen_msr_safe(char *str)
114115
{
115116
if (str)
116-
return strtobool(str, &xen_msr_safe);
117+
return kstrtobool(str, &xen_msr_safe);
117118
return -EINVAL;
118119
}
119120
early_param("xen_msr_safe", parse_xen_msr_safe);

arch/x86/xen/setup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/init.h>
99
#include <linux/sched.h>
10+
#include <linux/kstrtox.h>
1011
#include <linux/mm.h>
1112
#include <linux/pm.h>
1213
#include <linux/memblock.h>
@@ -85,7 +86,7 @@ static void __init xen_parse_512gb(void)
8586
arg = strstr(xen_start_info->cmd_line, "xen_512gb_limit=");
8687
if (!arg)
8788
val = true;
88-
else if (strtobool(arg + strlen("xen_512gb_limit="), &val))
89+
else if (kstrtobool(arg + strlen("xen_512gb_limit="), &val))
8990
return;
9091

9192
xen_512gb_limit = val;

drivers/xen/pcpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ static int register_pcpu(struct pcpu *pcpu)
228228

229229
err = device_register(dev);
230230
if (err) {
231-
pcpu_release(dev);
231+
put_device(dev);
232232
return err;
233233
}
234234

drivers/xen/platform-pci.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ static uint64_t get_callback_via(struct pci_dev *pdev)
5454
pin = pdev->pin;
5555

5656
/* We don't know the GSI. Specify the PCI INTx line instead. */
57-
return ((uint64_t)0x01 << HVM_CALLBACK_VIA_TYPE_SHIFT) | /* PCI INTx identifier */
57+
return ((uint64_t)HVM_PARAM_CALLBACK_TYPE_PCI_INTX <<
58+
HVM_CALLBACK_VIA_TYPE_SHIFT) |
5859
((uint64_t)pci_domain_nr(pdev->bus) << 32) |
5960
((uint64_t)pdev->bus->number << 16) |
6061
((uint64_t)(pdev->devfn & 0xff) << 8) |
@@ -144,21 +145,24 @@ static int platform_pci_probe(struct pci_dev *pdev,
144145
if (ret) {
145146
dev_warn(&pdev->dev, "Unable to set the evtchn callback "
146147
"err=%d\n", ret);
147-
goto out;
148+
goto irq_out;
148149
}
149150
}
150151

151152
max_nr_gframes = gnttab_max_grant_frames();
152153
grant_frames = alloc_xen_mmio(PAGE_SIZE * max_nr_gframes);
153154
ret = gnttab_setup_auto_xlat_frames(grant_frames);
154155
if (ret)
155-
goto out;
156+
goto irq_out;
156157
ret = gnttab_init();
157158
if (ret)
158159
goto grant_out;
159160
return 0;
160161
grant_out:
161162
gnttab_free_auto_xlat_frames();
163+
irq_out:
164+
if (!xen_have_vector_callback)
165+
free_irq(pdev->irq, pdev);
162166
out:
163167
pci_release_region(pdev, 0);
164168
mem_out:

drivers/xen/xen-pciback/conf_space_capability.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,13 +190,16 @@ static const struct config_field caplist_pm[] = {
190190
};
191191

192192
static struct msi_msix_field_config {
193-
u16 enable_bit; /* bit for enabling MSI/MSI-X */
194-
unsigned int int_type; /* interrupt type for exclusiveness check */
193+
u16 enable_bit; /* bit for enabling MSI/MSI-X */
194+
u16 allowed_bits; /* bits allowed to be changed */
195+
unsigned int int_type; /* interrupt type for exclusiveness check */
195196
} msi_field_config = {
196197
.enable_bit = PCI_MSI_FLAGS_ENABLE,
198+
.allowed_bits = PCI_MSI_FLAGS_ENABLE,
197199
.int_type = INTERRUPT_TYPE_MSI,
198200
}, msix_field_config = {
199201
.enable_bit = PCI_MSIX_FLAGS_ENABLE,
202+
.allowed_bits = PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL,
200203
.int_type = INTERRUPT_TYPE_MSIX,
201204
};
202205

@@ -229,7 +232,7 @@ static int msi_msix_flags_write(struct pci_dev *dev, int offset, u16 new_value,
229232
return 0;
230233

231234
if (!dev_data->allow_interrupt_control ||
232-
(new_value ^ old_value) & ~field_config->enable_bit)
235+
(new_value ^ old_value) & ~field_config->allowed_bits)
233236
return PCIBIOS_SET_FAILED;
234237

235238
if (new_value & field_config->enable_bit) {

0 commit comments

Comments
 (0)