From: Shannon Zhao <shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Julien Grall
<julien.grall-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>,
ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org,
stefano.stabellini-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org,
catalin.marinas-5wv7dgnIgG8@public.gmane.org,
will.deacon-5wv7dgnIgG8@public.gmane.org,
ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
mark.rutland-5wv7dgnIgG8@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
hangaohuai-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
peter.huangpeng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
xen-devel-GuqFBffKawuEi8DpZVb4nw@public.gmane.org,
zhaoshenglong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org,
christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Subject: Re: [Xen-devel] [PATCH 02/13] xen/grant-table: Move xlated_setup_gnttab_pages to common place
Date: Wed, 18 Nov 2015 21:34:25 +0800 [thread overview]
Message-ID: <564C7E61.80700@linaro.org> (raw)
In-Reply-To: <564C6E4C.9080003-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
On 2015/11/18 20:25, Julien Grall wrote:
> Hi Shannon,
>
> On 17/11/15 09:57, shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org wrote:
>> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
>> index 62f591f..c084ba6 100644
>> --- a/drivers/xen/grant-table.c
>> +++ b/drivers/xen/grant-table.c
>> @@ -664,6 +664,55 @@ int gnttab_setup_auto_xlat_frames(phys_addr_t addr)
>> }
>> EXPORT_SYMBOL_GPL(gnttab_setup_auto_xlat_frames);
>>
>> +int __init xlated_setup_gnttab_pages(void)
>> +{
>> + struct page **pages;
>> + xen_pfn_t *pfns;
>> + void *vaddr;
>> + int rc;
>> + unsigned int i;
>> + unsigned long nr_grant_frames = gnttab_max_grant_frames();
>> +
>> + BUG_ON(nr_grant_frames == 0);
>> + pages = kcalloc(nr_grant_frames, sizeof(pages[0]), GFP_KERNEL);
>> + if (!pages)
>> + return -ENOMEM;
>> +
>> + pfns = kcalloc(nr_grant_frames, sizeof(pfns[0]), GFP_KERNEL);
>> + if (!pfns) {
>> + kfree(pages);
>> + return -ENOMEM;
>> + }
>> + rc = alloc_xenballooned_pages(nr_grant_frames, pages, 0 /* lowmem */);
>
> Can you rebase your patch on top of linux/master? The 3rd parameters has
> been dropped for alloc_xenballooned_pages.
>
Sure, I rebase this patchset on Linux 4.3 and will rebase on master at
next version.
>> + if (rc) {
>> + pr_warn("%s Couldn't balloon alloc %ld pfns rc:%d\n", __func__,
>> + nr_grant_frames, rc);
>> + kfree(pages);
>> + kfree(pfns);
>> + return rc;
>> + }
>> + for (i = 0; i < nr_grant_frames; i++)
>> + pfns[i] = page_to_pfn(pages[i]);
>
> This code needs to be adapt for 64KB page granularity. Please use
> page_to_xen_pfn here.
>
Ok.
>> +
>> + vaddr = vmap(pages, nr_grant_frames, 0, PAGE_KERNEL);
>> + if (!vaddr) {
>> + pr_warn("%s Couldn't map %ld pfns rc:%d\n", __func__,
>> + nr_grant_frames, rc);
>> + free_xenballooned_pages(nr_grant_frames, pages);
>> + kfree(pages);
>> + kfree(pfns);
>> + return -ENOMEM;
>> + }
>> + kfree(pages);
>> +
>> + xen_auto_xlat_grant_frames.pfn = pfns;
>> + xen_auto_xlat_grant_frames.count = nr_grant_frames;
>> + xen_auto_xlat_grant_frames.vaddr = vaddr;
>> +
>> + return 0;
>> +}
>> +EXPORT_SYMBOL_GPL(xlated_setup_gnttab_pages);
>> +
>> void gnttab_free_auto_xlat_frames(void)
>> {
>> if (!xen_auto_xlat_grant_frames.count)
>> diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
>> index 4478f4b..fa31e66 100644
>> --- a/include/xen/grant_table.h
>> +++ b/include/xen/grant_table.h
>> @@ -177,6 +177,7 @@ struct grant_frames {
>> extern struct grant_frames xen_auto_xlat_grant_frames;
>> unsigned int gnttab_max_grant_frames(void);
>> int gnttab_setup_auto_xlat_frames(phys_addr_t addr);
>> +int xlated_setup_gnttab_pages(void);
>> void gnttab_free_auto_xlat_frames(void);
>>
>> #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
>>
>
> Regards,
>
>
--
Shannon
next prev parent reply other threads:[~2015-11-18 13:34 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 9:56 [PATCH 00/13] Add ACPI support for Xen Dom0 on ARM64 shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-1-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-17 9:56 ` [PATCH 01/13] Xen : Hide UART used by Xen shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-2-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-20 16:07 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 02/13] xen/grant-table: Move xlated_setup_gnttab_pages to common place shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-3-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-17 16:02 ` [Xen-devel] " David Vrabel
[not found] ` <564B4F80.2020402-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2015-11-18 4:32 ` Shannon Zhao
[not found] ` <564BFF6C.3070208-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-11-18 10:38 ` David Vrabel
2015-11-18 12:25 ` Julien Grall
[not found] ` <564C6E4C.9080003-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2015-11-18 13:34 ` Shannon Zhao [this message]
2015-11-17 9:57 ` [PATCH 03/13] arm/xen: Use xlated_setup_gnttab_pages to setup grant table shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-4-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-20 16:19 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 04/13] xen: memory : Add new XENMAPSPACE type XENMAPSPACE_dev_mmio shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-5-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-17 11:16 ` Ard Biesheuvel
2015-11-17 9:57 ` [PATCH 05/13] Xen: ARM: Add support for mapping platform device mmio shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
2015-11-17 14:38 ` Konrad Rzeszutek Wilk
[not found] ` <20151117143822.GH3003-he5eyhs8q0BAdwtm4QZOy9BPR1lH4CV8@public.gmane.org>
2015-11-18 5:48 ` [Xen-devel] " Shannon Zhao
[not found] ` <1447754231-7772-6-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-17 16:32 ` David Vrabel
[not found] ` <564B56B2.4030901-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2015-11-18 6:11 ` Shannon Zhao
2015-11-20 16:30 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 06/13] Xen: ARM: Add support for mapping amba " shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
2015-11-17 14:40 ` Konrad Rzeszutek Wilk
[not found] ` <20151117144040.GI3003-he5eyhs8q0BAdwtm4QZOy9BPR1lH4CV8@public.gmane.org>
2015-11-18 6:03 ` [Xen-devel] " Shannon Zhao
[not found] ` <564C14CA.9080601-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2015-11-18 12:27 ` Julien Grall
[not found] ` <564C6EBF.7010105-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2015-11-18 13:15 ` Shannon Zhao
2015-11-17 16:36 ` David Vrabel
[not found] ` <1447754231-7772-7-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-20 16:39 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 07/13] ARM: Xen: Document UEFI support on Xen ARM virtual platforms shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-8-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-17 16:46 ` [Xen-devel] " David Vrabel
[not found] ` <564B59F3.2060801-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2015-11-18 6:33 ` Shannon Zhao
2015-11-20 16:42 ` Stefano Stabellini
2015-11-17 20:44 ` Rob Herring
2015-11-18 6:24 ` Shannon Zhao
2015-11-17 9:57 ` [PATCH 08/13] Xen: EFI: Parse DT parameters for Xen specific UEFI shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-9-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-17 11:25 ` Ard Biesheuvel
[not found] ` <CAKv+Gu98L_dQYVhvGQG=d9Uga-x3mJ=4oxtQqvgU-D3DvcrwHg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-17 11:37 ` Mark Rutland
2015-11-17 12:17 ` Ard Biesheuvel
[not found] ` <CAKv+Gu-hjj0Mh3vUv86Y5Mk7STKP+ykBD_MXGcQWH1quWJ1jMA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-11-18 6:26 ` Shannon Zhao
2015-11-20 17:04 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 09/13] ARM: Xen: Initialize Xen specific UEFI runtime services shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-10-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-17 11:28 ` Ard Biesheuvel
2015-11-17 12:17 ` Shannon Zhao
2015-11-20 16:57 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 10/13] ARM64: ACPI: Check if it runs on Xen to enable or disable ACPI shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-11-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-20 17:20 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 11/13] xen/hvm/params: Add a new dilivery type for event-channel in HVM_PARAM_CALLBACK_IRQ shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-12-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-20 17:07 ` Stefano Stabellini
[not found] ` <alpine.DEB.2.02.1511201706070.1107-7Z66fg9igcxYtxbxJUhB2Dgeux46jI+i@public.gmane.org>
2015-11-20 17:22 ` [Xen-devel] " Andrew Cooper
[not found] ` <564F56C9.8060007-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>
2015-11-20 17:32 ` Stefano Stabellini
2015-11-17 9:57 ` [PATCH 12/13] arm/xen: Get event-channel irq through HVM_PARAM when booting with ACPI shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-13-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-20 17:11 ` Stefano Stabellini
2015-11-24 3:49 ` Shannon Zhao
2015-11-17 9:57 ` [PATCH 13/13] ARM: XEN: Move xen_early_init() before efi_init() shannon.zhao-QSEj5FYQhm4dnm+yROfE0A
[not found] ` <1447754231-7772-14-git-send-email-shannon.zhao-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-20 17:30 ` Stefano Stabellini
2015-11-24 3:50 ` Shannon Zhao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=564C7E61.80700@linaro.org \
--to=shannon.zhao-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
--cc=christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hangaohuai-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=ian.campbell-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org \
--cc=julien.grall-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=peter.huangpeng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=stefano.stabellini-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@public.gmane.org \
--cc=xen-devel-GuqFBffKawuEi8DpZVb4nw@public.gmane.org \
--cc=zhaoshenglong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).