Skip to content

Commit 8e8b180

Browse files
committed
Merge tag 'stable/for-linus-3.9-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen
Pull Xen bug-fixes from Konrad Rzeszutek Wilk: - Update the Xen ACPI memory and CPU hotplug locking mechanism. - Fix PAT issues wherein various applications would not start - Fix handling of multiple MSI as AHCI now does it. - Fix ARM compile failures. * tag 'stable/for-linus-3.9-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xenbus: fix compile failure on ARM with Xen enabled xen/pci: We don't do multiple MSI's. xen/pat: Disable PAT using pat_enabled value. xen/acpi: xen cpu hotplug minor updates xen/acpi: xen memory hotplug minor updates
2 parents 56a79b7 + 45e2716 commit 8e8b180

File tree

5 files changed

+57
-49
lines changed

5 files changed

+57
-49
lines changed

arch/x86/pci/xen.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
162162
struct msi_desc *msidesc;
163163
int *v;
164164

165+
if (type == PCI_CAP_ID_MSI && nvec > 1)
166+
return 1;
167+
165168
v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL);
166169
if (!v)
167170
return -ENOMEM;
@@ -220,6 +223,9 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
220223
struct msi_desc *msidesc;
221224
struct msi_msg msg;
222225

226+
if (type == PCI_CAP_ID_MSI && nvec > 1)
227+
return 1;
228+
223229
list_for_each_entry(msidesc, &dev->msi_list, list) {
224230
__read_msi_msg(msidesc, &msg);
225231
pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
@@ -263,6 +269,9 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
263269
int ret = 0;
264270
struct msi_desc *msidesc;
265271

272+
if (type == PCI_CAP_ID_MSI && nvec > 1)
273+
return 1;
274+
266275
list_for_each_entry(msidesc, &dev->msi_list, list) {
267276
struct physdev_map_pirq map_irq;
268277
domid_t domid;

arch/x86/xen/enlighten.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#include <asm/hypervisor.h>
6868
#include <asm/mwait.h>
6969
#include <asm/pci_x86.h>
70+
#include <asm/pat.h>
7071

7172
#ifdef CONFIG_ACPI
7273
#include <linux/acpi.h>
@@ -1417,7 +1418,14 @@ asmlinkage void __init xen_start_kernel(void)
14171418
*/
14181419
acpi_numa = -1;
14191420
#endif
1420-
1421+
#ifdef CONFIG_X86_PAT
1422+
/*
1423+
* For right now disable the PAT. We should remove this once
1424+
* git commit 8eaffa67b43e99ae581622c5133e20b0f48bcef1
1425+
* (xen/pat: Disable PAT support for now) is reverted.
1426+
*/
1427+
pat_enabled = 0;
1428+
#endif
14211429
/* Don't do the full vcpu_info placement stuff until we have a
14221430
possible map and a non-dummy shared_info. */
14231431
per_cpu(xen_vcpu, 0) = &HYPERVISOR_shared_info->vcpu_info[0];

drivers/xen/xen-acpi-cpuhotplug.c

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -239,24 +239,6 @@ static acpi_status xen_acpi_cpu_hotadd(struct acpi_processor *pr)
239239
return AE_OK;
240240
}
241241

242-
static
243-
int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device)
244-
{
245-
acpi_handle phandle;
246-
struct acpi_device *pdev;
247-
248-
if (acpi_get_parent(handle, &phandle))
249-
return -ENODEV;
250-
251-
if (acpi_bus_get_device(phandle, &pdev))
252-
return -ENODEV;
253-
254-
if (acpi_bus_scan(handle))
255-
return -ENODEV;
256-
257-
return 0;
258-
}
259-
260242
static int acpi_processor_device_remove(struct acpi_device *device)
261243
{
262244
pr_debug(PREFIX "Xen does not support CPU hotremove\n");
@@ -272,6 +254,8 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
272254
u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */
273255
int result;
274256

257+
acpi_scan_lock_acquire();
258+
275259
switch (event) {
276260
case ACPI_NOTIFY_BUS_CHECK:
277261
case ACPI_NOTIFY_DEVICE_CHECK:
@@ -286,12 +270,16 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
286270
if (!acpi_bus_get_device(handle, &device))
287271
break;
288272

289-
result = acpi_processor_device_add(handle, &device);
273+
result = acpi_bus_scan(handle);
290274
if (result) {
291275
pr_err(PREFIX "Unable to add the device\n");
292276
break;
293277
}
294-
278+
result = acpi_bus_get_device(handle, &device);
279+
if (result) {
280+
pr_err(PREFIX "Missing device object\n");
281+
break;
282+
}
295283
ost_code = ACPI_OST_SC_SUCCESS;
296284
break;
297285

@@ -321,11 +309,13 @@ static void acpi_processor_hotplug_notify(acpi_handle handle,
321309
"Unsupported event [0x%x]\n", event));
322310

323311
/* non-hotplug event; possibly handled by other handler */
324-
return;
312+
goto out;
325313
}
326314

327315
(void) acpi_evaluate_hotplug_ost(handle, event, ost_code, NULL);
328-
return;
316+
317+
out:
318+
acpi_scan_lock_release();
329319
}
330320

331321
static acpi_status is_processor_device(acpi_handle handle)

drivers/xen/xen-acpi-memhotplug.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -158,50 +158,46 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
158158
return 0;
159159
}
160160

161-
static int
162-
acpi_memory_get_device(acpi_handle handle,
163-
struct acpi_memory_device **mem_device)
161+
static int acpi_memory_get_device(acpi_handle handle,
162+
struct acpi_memory_device **mem_device)
164163
{
165-
acpi_status status;
166-
acpi_handle phandle;
167164
struct acpi_device *device = NULL;
168-
struct acpi_device *pdevice = NULL;
169-
int result;
165+
int result = 0;
170166

171-
if (!acpi_bus_get_device(handle, &device) && device)
172-
goto end;
167+
acpi_scan_lock_acquire();
173168

174-
status = acpi_get_parent(handle, &phandle);
175-
if (ACPI_FAILURE(status)) {
176-
pr_warn(PREFIX "Cannot find acpi parent\n");
177-
return -EINVAL;
178-
}
179-
180-
/* Get the parent device */
181-
result = acpi_bus_get_device(phandle, &pdevice);
182-
if (result) {
183-
pr_warn(PREFIX "Cannot get acpi bus device\n");
184-
return -EINVAL;
185-
}
169+
acpi_bus_get_device(handle, &device);
170+
if (device)
171+
goto end;
186172

187173
/*
188174
* Now add the notified device. This creates the acpi_device
189175
* and invokes .add function
190176
*/
191177
result = acpi_bus_scan(handle);
192178
if (result) {
193-
pr_warn(PREFIX "Cannot add acpi bus\n");
194-
return -EINVAL;
179+
pr_warn(PREFIX "ACPI namespace scan failed\n");
180+
result = -EINVAL;
181+
goto out;
182+
}
183+
result = acpi_bus_get_device(handle, &device);
184+
if (result) {
185+
pr_warn(PREFIX "Missing device object\n");
186+
result = -EINVAL;
187+
goto out;
195188
}
196189

197190
end:
198191
*mem_device = acpi_driver_data(device);
199192
if (!(*mem_device)) {
200-
pr_err(PREFIX "Driver data not found\n");
201-
return -ENODEV;
193+
pr_err(PREFIX "driver data not found\n");
194+
result = -ENODEV;
195+
goto out;
202196
}
203197

204-
return 0;
198+
out:
199+
acpi_scan_lock_release();
200+
return result;
205201
}
206202

207203
static int acpi_memory_check_device(struct acpi_memory_device *mem_device)
@@ -259,12 +255,15 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
259255
ACPI_DEBUG_PRINT((ACPI_DB_INFO,
260256
"\nReceived EJECT REQUEST notification for device\n"));
261257

258+
acpi_scan_lock_acquire();
262259
if (acpi_bus_get_device(handle, &device)) {
260+
acpi_scan_lock_release();
263261
pr_err(PREFIX "Device doesn't exist\n");
264262
break;
265263
}
266264
mem_device = acpi_driver_data(device);
267265
if (!mem_device) {
266+
acpi_scan_lock_release();
268267
pr_err(PREFIX "Driver Data is NULL\n");
269268
break;
270269
}
@@ -274,6 +273,7 @@ static void acpi_memory_device_notify(acpi_handle handle, u32 event, void *data)
274273
* acpi_bus_remove if Xen support hotremove in the future
275274
*/
276275
acpi_memory_disable_device(mem_device);
276+
acpi_scan_lock_release();
277277
break;
278278

279279
default:

drivers/xen/xenbus/xenbus_client.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
* IN THE SOFTWARE.
3131
*/
3232

33+
#include <linux/mm.h>
3334
#include <linux/slab.h>
3435
#include <linux/types.h>
3536
#include <linux/spinlock.h>

0 commit comments

Comments
 (0)