[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [PATCH v2 6/9] xen/arm: add P2M type parameter in guest_physmap_add_pages
- To: Julien Grall <julien@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Penny Zheng <Penny.Zheng@xxxxxxx>
- Date: Sat, 7 May 2022 09:20:49 +0000
- Accept-language: en-US
- Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
- Arc-message-signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L4cXI1jrvipil1Uc8qsyj9LOctdmx7HmZqFp41ZPEdY=; b=D5DnCjGSfRqwRVRnORQRQ+EEljNwUTphd+iGmR+wlY4brWCezY/Y2A7VYnRfjiSARwCBl1SrdyqDJbkzhIIjxRvnJBK456Z80vIvy33dfYyi60nojquBBGT/gjyX5gAN0S1wwKgcbzIwGqksGPiGYD/8SlgjVzTwz00iAqQs8P7Rs4we6VUHhBcNlGP64JBkZmtnpYikXThfZ/53wp72lHLehlbPXbztFSUBSqOlyUzfk9003kjuoHpbDcR9pCYcVRzYo4BYwPIRriocHqTnq9XcIdgOPLZUPCkWXYzcUOH4wrP6nxgeIXAdznk4oMi+9IDnw3HLt6MEGV8HgDocwA==
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=L4cXI1jrvipil1Uc8qsyj9LOctdmx7HmZqFp41ZPEdY=; b=Md3EqsYUFEOIh0pGV4gdCuu3uaeiNuFh0D3uXO0Tz98PpX02Suyf8Nw+mH5oIkYsk03C7QL143kGUPZnT8nnHDE3sYV71nPzspmMp69EP9cBwJwiEf8oLlggVWGrjdDeNvGfZcAbgktHnXmIx3y8bnRkVkVM0AX/kcC+61e88dMZXF8ifGzXfMVAEKfptEJQ50dlqTwbTBGOQEqATziH6zq2GWhjh2Om7FMOs5E+N7BAy8AvoHMJZTwZXFtA/mM1GADYRei8SXEa5VvWf2jMuwsKsOktgrz8gLk1fPRvFnfcBl1xBiJhiTxy8//yh6PJeCaG/HrPc96Kp53Q8bt+XQ==
- Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=ZcABmErkokP8iYM3OMIexxrXkKzGreZrK88fwCUBWJue22I7fpdL8CnPzXOEt3swYp2luvgqo5XbiVaBo+qjQN+N49WoOaC7Zx8lPb+v9j8A486DJy11rhfLS5oTfYrsMCmVwHnnW4Kf1AsHGpKlB7Ej0InCFEVWncNnm0FrAmrRMoWOIQcWfKq/WEdR6nHrJBNzyOOSqrYGMxQKJCKYS08pzojkvJwopfMd2t0/JbQ2vi9itwsbWwGJWYZnHuwpjM/TS1Qtc1+kcueiydPfqRbcGaSJF4+Q/QtdYIOBy8gzdXsN89qKpbh2EHFjQo8e0Uw15l5aOehH6IiUjwZtnA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SVcBIPe5ch5oihU7G5NQP70K88mnuV9as8YVtuQGVaCWOZ0i0WuByHO5uDtvXWR236IS4NZKWSth0NjycOuDAgOGoA9NExNjTcRYCpkuxazn/JkP8B/d6Ju18csG82yYCtNu+gE0AJAOAtloimVWAq9Yd/lM195hc0t1nLfowuH3vLFDB+U4A1EHT76yXF5tVeSctEMuW6iUZfUCnSEODma7miIgRSBbHoXwcfkDjbbcgI2sDgPI6IZYag+wGF6DQ2++SjLr9sYzW68UC1lDZFTiRoq0GKsvO//N/XMCdRegMi91Yn8YOBqzVNfWaRBiWldaflHo4ArZ5FA166Cxpg==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Wei Chen <Wei.Chen@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Delivery-date: Sat, 07 May 2022 09:21:14 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Thread-index: AQHYYRqTRs6WKDynUESu6+gNH4KxLK0TH6WAgAAFK1A=
- Thread-topic: [PATCH v2 6/9] xen/arm: add P2M type parameter in guest_physmap_add_pages
Hi julien
> -----Original Message-----
> From: Julien Grall <julien@xxxxxxx>
> Sent: Saturday, May 7, 2022 5:01 PM
> To: Penny Zheng <Penny.Zheng@xxxxxxx>; xen-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Wei Chen <Wei.Chen@xxxxxxx>; Stefano Stabellini
> <sstabellini@xxxxxxxxxx>; Bertrand Marquis <Bertrand.Marquis@xxxxxxx>;
> Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
> Subject: Re: [PATCH v2 6/9] xen/arm: add P2M type parameter in
> guest_physmap_add_pages
>
> Hi,
>
> On 06/05/2022 08:24, Penny Zheng wrote:
> > In order to cover the scenario where users intend to set up guest p2m
> > foreign mapping with nr_pages, this commit adds a new P2M type
> > parameter in guest_physmap_add_pages.
>
> With this patch, guest_physmap_add_pages() and guest_physmap_add_page()
> will behave differently. The former will be able to deal with any type whilst
> the
> latter can only handle RAM type.
>
> I think we need to stay consistent with the name. Looking at the existing
> helper, we already have one that should suit you (see map_regions_p2mt()).
> So this patch looks unnecessary.
>
Right, map_regions_p2mt has the P2M type as parameter. I'll change to it. Thx~
> Cheers,
>
> >
> > Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx>
> > ---
> > v2 change:
> > - no change
> > ---
> > xen/arch/arm/domain_build.c | 5 +++--
> > xen/arch/arm/include/asm/p2m.h | 5 +++--
> > 2 files changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> > index b3ba0c501d..089b9e99fc 100644
> > --- a/xen/arch/arm/domain_build.c
> > +++ b/xen/arch/arm/domain_build.c
> > @@ -507,7 +507,7 @@ static bool __init
> append_static_memory_to_bank(struct domain *d,
> > else
> > sgfn = gaddr_to_gfn(mfn_to_maddr(smfn));
> >
> > - res = guest_physmap_add_pages(d, sgfn, smfn, nr_pages);
> > + res = guest_physmap_add_pages(d, sgfn, smfn, nr_pages,
> > + p2m_ram_rw);
> > if ( res )
> > {
> > dprintk(XENLOG_ERR, "Failed to map pages to DOMU: %d", res);
> > @@ -850,7 +850,8 @@ static int __init allocate_shared_memory(struct
> domain *d,
> > nr_pages = PFN_DOWN(psize);
> > if ( d != dom_io )
> > {
> > - ret = guest_physmap_add_pages(d, gaddr_to_gfn(gbase), smfn,
> PFN_DOWN(psize));
> > + ret = guest_physmap_add_pages(d, gaddr_to_gfn(gbase), smfn,
> nr_pages,
> > + p2m_ram_rw);
> > if ( ret )
> > {
> > printk(XENLOG_ERR
> > diff --git a/xen/arch/arm/include/asm/p2m.h
> > b/xen/arch/arm/include/asm/p2m.h index 8cce459b67..58590145b0 100644
> > --- a/xen/arch/arm/include/asm/p2m.h
> > +++ b/xen/arch/arm/include/asm/p2m.h
> > @@ -317,9 +317,10 @@ guest_physmap_add_page(struct domain *d, gfn_t
> gfn, mfn_t mfn,
> > static inline int guest_physmap_add_pages(struct domain *d,
> > gfn_t gfn,
> > mfn_t mfn,
> > - unsigned int nr_pages)
> > + unsigned int nr_pages,
> > + p2m_type_t t)
> > {
> > - return p2m_insert_mapping(d, gfn, nr_pages, mfn, p2m_ram_rw);
> > + return p2m_insert_mapping(d, gfn, nr_pages, mfn, t);
> > }
> >
> > mfn_t gfn_to_mfn(struct domain *d, gfn_t gfn);
>
> --
> Julien Grall
|