mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
xen: Fixes for rc2
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABAgAGBQJZxSV8AAoJELDendYovxMvf5YH/jUEgeFVgP0KRjNsvgp4gu88 4BW7nWYtFt4gGE1KnrKEPbg5Je0OwkpW7vUXxvLwDGWymtHMzVuuB2xxwzkePyzS 17Kzmb/JiuaNpVF4+5v3JvAw3b9iHrZ7T6cXOQgm28agd3m/y+9FSyzoMoNNRdGG xURwUyK1idRqtkQV5VsQAK0Z1lVF7YhhaxWXBtClsqnKWoeLBLc8fpRJmUNruA33 E2Sdi06mNNN3xudu1s2edC5hAO4EgVKmonnmyHRYonIYwuqSND8fhEXj+PRdHj7s lLVRQixd3raBiSscLASaQ7I/66frBm+TXzmoHAVtYkdlXBJlisTIvQlMPtAwu60= =c3HX -----END PGP SIGNATURE----- Merge tag 'for-linus-4.14b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip Pull xen fixes from Juergen Gross: "A fix for a missing __init annotation and two cleanup patches" * tag 'for-linus-4.14b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip: xen, arm64: drop dummy lookup_address() xen: don't compile pv-specific parts if XEN_PV isn't configured xen: x86: mark xen_find_pt_base as __init
This commit is contained in:
commit
0a8abd97dc
3 changed files with 68 additions and 74 deletions
|
@ -2220,7 +2220,7 @@ static void __init xen_write_cr3_init(unsigned long cr3)
|
||||||
* not the first page table in the page table pool.
|
* not the first page table in the page table pool.
|
||||||
* Iterate through the initial page tables to find the real page table base.
|
* Iterate through the initial page tables to find the real page table base.
|
||||||
*/
|
*/
|
||||||
static phys_addr_t xen_find_pt_base(pmd_t *pmd)
|
static phys_addr_t __init xen_find_pt_base(pmd_t *pmd)
|
||||||
{
|
{
|
||||||
phys_addr_t pt_base, paddr;
|
phys_addr_t pt_base, paddr;
|
||||||
unsigned pmdidx;
|
unsigned pmdidx;
|
||||||
|
|
|
@ -519,64 +519,6 @@ static int __xenbus_map_ring(struct xenbus_device *dev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int xenbus_map_ring_valloc_pv(struct xenbus_device *dev,
|
|
||||||
grant_ref_t *gnt_refs,
|
|
||||||
unsigned int nr_grefs,
|
|
||||||
void **vaddr)
|
|
||||||
{
|
|
||||||
struct xenbus_map_node *node;
|
|
||||||
struct vm_struct *area;
|
|
||||||
pte_t *ptes[XENBUS_MAX_RING_GRANTS];
|
|
||||||
phys_addr_t phys_addrs[XENBUS_MAX_RING_GRANTS];
|
|
||||||
int err = GNTST_okay;
|
|
||||||
int i;
|
|
||||||
bool leaked;
|
|
||||||
|
|
||||||
*vaddr = NULL;
|
|
||||||
|
|
||||||
if (nr_grefs > XENBUS_MAX_RING_GRANTS)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
node = kzalloc(sizeof(*node), GFP_KERNEL);
|
|
||||||
if (!node)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
area = alloc_vm_area(XEN_PAGE_SIZE * nr_grefs, ptes);
|
|
||||||
if (!area) {
|
|
||||||
kfree(node);
|
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < nr_grefs; i++)
|
|
||||||
phys_addrs[i] = arbitrary_virt_to_machine(ptes[i]).maddr;
|
|
||||||
|
|
||||||
err = __xenbus_map_ring(dev, gnt_refs, nr_grefs, node->handles,
|
|
||||||
phys_addrs,
|
|
||||||
GNTMAP_host_map | GNTMAP_contains_pte,
|
|
||||||
&leaked);
|
|
||||||
if (err)
|
|
||||||
goto failed;
|
|
||||||
|
|
||||||
node->nr_handles = nr_grefs;
|
|
||||||
node->pv.area = area;
|
|
||||||
|
|
||||||
spin_lock(&xenbus_valloc_lock);
|
|
||||||
list_add(&node->next, &xenbus_valloc_pages);
|
|
||||||
spin_unlock(&xenbus_valloc_lock);
|
|
||||||
|
|
||||||
*vaddr = area->addr;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
failed:
|
|
||||||
if (!leaked)
|
|
||||||
free_vm_area(area);
|
|
||||||
else
|
|
||||||
pr_alert("leaking VM area %p size %u page(s)", area, nr_grefs);
|
|
||||||
|
|
||||||
kfree(node);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct map_ring_valloc_hvm
|
struct map_ring_valloc_hvm
|
||||||
{
|
{
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
@ -725,6 +667,65 @@ int xenbus_unmap_ring_vfree(struct xenbus_device *dev, void *vaddr)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree);
|
EXPORT_SYMBOL_GPL(xenbus_unmap_ring_vfree);
|
||||||
|
|
||||||
|
#ifdef CONFIG_XEN_PV
|
||||||
|
static int xenbus_map_ring_valloc_pv(struct xenbus_device *dev,
|
||||||
|
grant_ref_t *gnt_refs,
|
||||||
|
unsigned int nr_grefs,
|
||||||
|
void **vaddr)
|
||||||
|
{
|
||||||
|
struct xenbus_map_node *node;
|
||||||
|
struct vm_struct *area;
|
||||||
|
pte_t *ptes[XENBUS_MAX_RING_GRANTS];
|
||||||
|
phys_addr_t phys_addrs[XENBUS_MAX_RING_GRANTS];
|
||||||
|
int err = GNTST_okay;
|
||||||
|
int i;
|
||||||
|
bool leaked;
|
||||||
|
|
||||||
|
*vaddr = NULL;
|
||||||
|
|
||||||
|
if (nr_grefs > XENBUS_MAX_RING_GRANTS)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
node = kzalloc(sizeof(*node), GFP_KERNEL);
|
||||||
|
if (!node)
|
||||||
|
return -ENOMEM;
|
||||||
|
|
||||||
|
area = alloc_vm_area(XEN_PAGE_SIZE * nr_grefs, ptes);
|
||||||
|
if (!area) {
|
||||||
|
kfree(node);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < nr_grefs; i++)
|
||||||
|
phys_addrs[i] = arbitrary_virt_to_machine(ptes[i]).maddr;
|
||||||
|
|
||||||
|
err = __xenbus_map_ring(dev, gnt_refs, nr_grefs, node->handles,
|
||||||
|
phys_addrs,
|
||||||
|
GNTMAP_host_map | GNTMAP_contains_pte,
|
||||||
|
&leaked);
|
||||||
|
if (err)
|
||||||
|
goto failed;
|
||||||
|
|
||||||
|
node->nr_handles = nr_grefs;
|
||||||
|
node->pv.area = area;
|
||||||
|
|
||||||
|
spin_lock(&xenbus_valloc_lock);
|
||||||
|
list_add(&node->next, &xenbus_valloc_pages);
|
||||||
|
spin_unlock(&xenbus_valloc_lock);
|
||||||
|
|
||||||
|
*vaddr = area->addr;
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
failed:
|
||||||
|
if (!leaked)
|
||||||
|
free_vm_area(area);
|
||||||
|
else
|
||||||
|
pr_alert("leaking VM area %p size %u page(s)", area, nr_grefs);
|
||||||
|
|
||||||
|
kfree(node);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static int xenbus_unmap_ring_vfree_pv(struct xenbus_device *dev, void *vaddr)
|
static int xenbus_unmap_ring_vfree_pv(struct xenbus_device *dev, void *vaddr)
|
||||||
{
|
{
|
||||||
struct xenbus_map_node *node;
|
struct xenbus_map_node *node;
|
||||||
|
@ -788,6 +789,12 @@ static int xenbus_unmap_ring_vfree_pv(struct xenbus_device *dev, void *vaddr)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct xenbus_ring_ops ring_ops_pv = {
|
||||||
|
.map = xenbus_map_ring_valloc_pv,
|
||||||
|
.unmap = xenbus_unmap_ring_vfree_pv,
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
struct unmap_ring_vfree_hvm
|
struct unmap_ring_vfree_hvm
|
||||||
{
|
{
|
||||||
unsigned int idx;
|
unsigned int idx;
|
||||||
|
@ -916,11 +923,6 @@ enum xenbus_state xenbus_read_driver_state(const char *path)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(xenbus_read_driver_state);
|
EXPORT_SYMBOL_GPL(xenbus_read_driver_state);
|
||||||
|
|
||||||
static const struct xenbus_ring_ops ring_ops_pv = {
|
|
||||||
.map = xenbus_map_ring_valloc_pv,
|
|
||||||
.unmap = xenbus_unmap_ring_vfree_pv,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct xenbus_ring_ops ring_ops_hvm = {
|
static const struct xenbus_ring_ops ring_ops_hvm = {
|
||||||
.map = xenbus_map_ring_valloc_hvm,
|
.map = xenbus_map_ring_valloc_hvm,
|
||||||
.unmap = xenbus_unmap_ring_vfree_hvm,
|
.unmap = xenbus_unmap_ring_vfree_hvm,
|
||||||
|
@ -928,8 +930,10 @@ static const struct xenbus_ring_ops ring_ops_hvm = {
|
||||||
|
|
||||||
void __init xenbus_ring_ops_init(void)
|
void __init xenbus_ring_ops_init(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_XEN_PV
|
||||||
if (!xen_feature(XENFEAT_auto_translated_physmap))
|
if (!xen_feature(XENFEAT_auto_translated_physmap))
|
||||||
ring_ops = &ring_ops_pv;
|
ring_ops = &ring_ops_pv;
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
ring_ops = &ring_ops_hvm;
|
ring_ops = &ring_ops_hvm;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,16 +84,6 @@ static inline xmaddr_t arbitrary_virt_to_machine(void *vaddr)
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* TODO: this shouldn't be here but it is because the frontend drivers
|
|
||||||
* are using it (its rolled in headers) even though we won't hit the code path.
|
|
||||||
* So for right now just punt with this.
|
|
||||||
*/
|
|
||||||
static inline pte_t *lookup_address(unsigned long address, unsigned int *level)
|
|
||||||
{
|
|
||||||
BUG();
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
|
extern int set_foreign_p2m_mapping(struct gnttab_map_grant_ref *map_ops,
|
||||||
struct gnttab_map_grant_ref *kmap_ops,
|
struct gnttab_map_grant_ref *kmap_ops,
|
||||||
struct page **pages, unsigned int count);
|
struct page **pages, unsigned int count);
|
||||||
|
|
Loading…
Add table
Reference in a new issue