xenpci.c (ef90af83a58199ef3980d8c9a7dad07ec9b4bea3) | xenpci.c (428b7ca290208e6b15d46440cd8d6309dc92dd2d) |
---|---|
1/* 2 * Copyright (c) 2008 Citrix Systems, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 63 unchanged lines hidden (view full) --- 72 73 error = BUS_SETUP_INTR(device_get_parent(device), device, 74 scp->res_irq, INTR_MPSAFE|INTR_TYPE_MISC, 75 xenpci_intr_filter, NULL, /*trap_frame*/NULL, 76 &scp->intr_cookie); 77 if (error) 78 return error; 79 | 1/* 2 * Copyright (c) 2008 Citrix Systems, Inc. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 63 unchanged lines hidden (view full) --- 72 73 error = BUS_SETUP_INTR(device_get_parent(device), device, 74 scp->res_irq, INTR_MPSAFE|INTR_TYPE_MISC, 75 xenpci_intr_filter, NULL, /*trap_frame*/NULL, 76 &scp->intr_cookie); 77 if (error) 78 return error; 79 |
80#ifdef SMP |
|
80 /* 81 * When using the PCI event delivery callback we cannot assign 82 * events to specific vCPUs, so all events are delivered to vCPU#0 by 83 * Xen. Since the PCI interrupt can fire on any CPU by default, we 84 * need to bind it to vCPU#0 in order to ensure that 85 * xen_intr_handle_upcall always gets called on vCPU#0. 86 */ 87 error = BUS_BIND_INTR(device_get_parent(device), device, 88 scp->res_irq, 0); 89 if (error) 90 return error; | 81 /* 82 * When using the PCI event delivery callback we cannot assign 83 * events to specific vCPUs, so all events are delivered to vCPU#0 by 84 * Xen. Since the PCI interrupt can fire on any CPU by default, we 85 * need to bind it to vCPU#0 in order to ensure that 86 * xen_intr_handle_upcall always gets called on vCPU#0. 87 */ 88 error = BUS_BIND_INTR(device_get_parent(device), device, 89 scp->res_irq, 0); 90 if (error) 91 return error; |
92#endif |
|
91 92 xen_hvm_set_callback(device); 93 return (0); 94} 95 96/* 97 * Deallocate anything allocated by xenpci_allocate_resources. 98 */ --- 205 unchanged lines hidden (view full) --- 304 * allocated on behalf of this driver. 305 */ 306 return (xenpci_deallocate_resources(dev)); 307} 308 309static int 310xenpci_suspend(device_t dev) 311{ | 93 94 xen_hvm_set_callback(device); 95 return (0); 96} 97 98/* 99 * Deallocate anything allocated by xenpci_allocate_resources. 100 */ --- 205 unchanged lines hidden (view full) --- 306 * allocated on behalf of this driver. 307 */ 308 return (xenpci_deallocate_resources(dev)); 309} 310 311static int 312xenpci_suspend(device_t dev) 313{ |
312 struct xenpci_softc *scp = device_get_softc(dev); 313 device_t parent = device_get_parent(dev); 314 315 if (scp->intr_cookie != NULL) { 316 if (BUS_TEARDOWN_INTR(parent, dev, scp->res_irq, 317 scp->intr_cookie) != 0) 318 printf("intr teardown failed.. continuing\n"); 319 scp->intr_cookie = NULL; 320 } 321 | |
322 return (bus_generic_suspend(dev)); 323} 324 325static int 326xenpci_resume(device_t dev) 327{ | 314 return (bus_generic_suspend(dev)); 315} 316 317static int 318xenpci_resume(device_t dev) 319{ |
328 struct xenpci_softc *scp = device_get_softc(dev); 329 device_t parent = device_get_parent(dev); 330 331 BUS_SETUP_INTR(parent, dev, scp->res_irq, 332 INTR_MPSAFE|INTR_TYPE_MISC, xenpci_intr_filter, NULL, 333 /*trap_frame*/NULL, &scp->intr_cookie); | |
334 xen_hvm_set_callback(dev); 335 return (bus_generic_resume(dev)); 336} 337 338static device_method_t xenpci_methods[] = { 339 /* Device interface */ 340 DEVMETHOD(device_probe, xenpci_probe), 341 DEVMETHOD(device_attach, xenpci_attach), --- 21 unchanged lines hidden --- | 320 xen_hvm_set_callback(dev); 321 return (bus_generic_resume(dev)); 322} 323 324static device_method_t xenpci_methods[] = { 325 /* Device interface */ 326 DEVMETHOD(device_probe, xenpci_probe), 327 DEVMETHOD(device_attach, xenpci_attach), --- 21 unchanged lines hidden --- |