xen: branch for v5.9-rc3

-----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRTLbB6QfY48x44uB6AXGG7T9hjvgUCX0om+wAKCRCAXGG7T9hj
 voTaAPwPON8QXtwfbyb1a5C2uWIlc7Sg1KR5z9Iel3iiZEAZwQD+MBtJ61iSFxw6
 Ri+7marWimyMZUhy8ug3UhHCse/oRAc=
 =Twkt
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-5.9-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip

Pull xen fixes from Juergen Gross:
 "Two fixes for Xen: one needed for ongoing work to support virtio with
  Xen, and one for a corner case in IRQ handling with Xen"

* tag 'for-linus-5.9-rc3-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
  arm/xen: Add misuse warning to virt_to_gfn
  xen/xenbus: Fix granting of vmalloc'd memory
  XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.
This commit is contained in:
Linus Torvalds 2020-08-29 12:44:30 -07:00
commit c8b5563abe
3 changed files with 21 additions and 11 deletions

View File

@ -156,7 +156,7 @@ int get_evtchn_to_irq(evtchn_port_t evtchn)
/* Get info for IRQ */
struct irq_info *info_for_irq(unsigned irq)
{
return irq_get_handler_data(irq);
return irq_get_chip_data(irq);
}
/* Constructors for packed IRQ information. */
@ -377,7 +377,7 @@ static void xen_irq_init(unsigned irq)
info->type = IRQT_UNBOUND;
info->refcnt = -1;
irq_set_handler_data(irq, info);
irq_set_chip_data(irq, info);
list_add_tail(&info->list, &xen_irq_list_head);
}
@ -426,14 +426,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
static void xen_free_irq(unsigned irq)
{
struct irq_info *info = irq_get_handler_data(irq);
struct irq_info *info = irq_get_chip_data(irq);
if (WARN_ON(!info))
return;
list_del(&info->list);
irq_set_handler_data(irq, NULL);
irq_set_chip_data(irq, NULL);
WARN_ON(info->refcnt > 0);
@ -603,7 +603,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
static void __unbind_from_irq(unsigned int irq)
{
evtchn_port_t evtchn = evtchn_from_irq(irq);
struct irq_info *info = irq_get_handler_data(irq);
struct irq_info *info = irq_get_chip_data(irq);
if (info->refcnt > 0) {
info->refcnt--;
@ -1108,7 +1108,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
void unbind_from_irqhandler(unsigned int irq, void *dev_id)
{
struct irq_info *info = irq_get_handler_data(irq);
struct irq_info *info = irq_get_chip_data(irq);
if (WARN_ON(!info))
return;
@ -1142,7 +1142,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn)
if (irq == -1)
return -ENOENT;
info = irq_get_handler_data(irq);
info = irq_get_chip_data(irq);
if (!info)
return -ENOENT;
@ -1170,7 +1170,7 @@ int evtchn_get(evtchn_port_t evtchn)
if (irq == -1)
goto done;
info = irq_get_handler_data(irq);
info = irq_get_chip_data(irq);
if (!info)
goto done;

View File

@ -379,8 +379,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
int i, j;
for (i = 0; i < nr_pages; i++) {
err = gnttab_grant_foreign_access(dev->otherend_id,
virt_to_gfn(vaddr), 0);
unsigned long gfn;
if (is_vmalloc_addr(vaddr))
gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr));
else
gfn = virt_to_gfn(vaddr);
err = gnttab_grant_foreign_access(dev->otherend_id, gfn, 0);
if (err < 0) {
xenbus_dev_fatal(dev, err,
"granting access to ring page");

View File

@ -76,7 +76,11 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn)
#define bfn_to_local_pfn(bfn) bfn_to_pfn(bfn)
/* VIRT <-> GUEST conversion */
#define virt_to_gfn(v) (pfn_to_gfn(virt_to_phys(v) >> XEN_PAGE_SHIFT))
#define virt_to_gfn(v) \
({ \
WARN_ON_ONCE(!virt_addr_valid(v)); \
pfn_to_gfn(virt_to_phys(v) >> XEN_PAGE_SHIFT); \
})
#define gfn_to_virt(m) (__va(gfn_to_pfn(m) << XEN_PAGE_SHIFT))
/* Only used in PV code. But ARM guests are always HVM. */