All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shannon Zhao <zhaoshenglong@huawei.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: ian.campbell@citrix.com, peter.huangpeng@huawei.com,
	xen-devel@lists.xen.org, julien.grall@citrix.com,
	stefano.stabellini@citrix.com, shannon.zhao@linaro.org
Subject: Re: [PATCH v4 05/10] acpi: Refactor acpi_os_map_memory to be architecturally independent
Date: Fri, 22 Jan 2016 16:38:31 +0800	[thread overview]
Message-ID: <56A1EA87.5050404@huawei.com> (raw)
In-Reply-To: <569CF7AF02000078000C806A@prv-mh.provo.novell.com>



On 2016/1/18 21:33, Jan Beulich wrote:
>>>> On 16.01.16 at 06:01, <zhaoshenglong@huawei.com> wrote:
>> > --- a/xen/drivers/acpi/osl.c
>> > +++ b/xen/drivers/acpi/osl.c
>> > @@ -86,17 +86,7 @@ acpi_physical_address __init acpi_os_get_root_pointer(void)
>> >  void __iomem *
>> >  acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
>> >  {
>> > -	if (system_state >= SYS_STATE_active) {
>> > -		mfn_t mfn = _mfn(PFN_DOWN(phys));
>> > -		unsigned int offs = phys & (PAGE_SIZE - 1);
>> > -
>> > -		/* The low first Mb is always mapped. */
>> > -		if ( !((phys + size - 1) >> 20) )
>> > -			return __va(phys);
>> > -		return __vmap(&mfn, PFN_UP(offs + size), 1, 1,
>> > -			      PAGE_HYPERVISOR_NOCACHE) + offs;
>> > -	}
>> > -	return __acpi_map_table(phys, size);
>> > +	return arch_acpi_os_map_memory(phys, size);
>> >  }
> I'm quite sure I've said before that this goes too far: The __vmap()
> part and likely also the early-boot __acpi_map_table() one already
> are architecture independent and hence should stay. The factoring
> hence should only concern the first Mb handling and maybe the
> the mapping attributes passed to __vmap().

Yes, the first MB handling and __vmap() should refactor. So if it only
moves them to an architecture function, how about below patch?

diff --git a/xen/arch/x86/acpi/lib.c b/xen/arch/x86/acpi/lib.c
index cc15ea3..5885a3a 100644
--- a/xen/arch/x86/acpi/lib.c
+++ b/xen/arch/x86/acpi/lib.c
@@ -33,6 +33,19 @@ u8 __read_mostly acpi_disable_value;
 u32 __read_mostly x86_acpiid_to_apicid[MAX_MADT_ENTRIES] =
     {[0 ... MAX_MADT_ENTRIES - 1] = BAD_APICID };

+void __iomem *
+arch_acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
+{
+       mfn_t mfn = _mfn(PFN_DOWN(phys));
+       unsigned int offs = phys & (PAGE_SIZE - 1);
+
+       /* The low first Mb is always mapped. */
+       if ( !((phys + size - 1) >> 20) )
+               return __va(phys);
+       return __vmap(&mfn, PFN_UP(offs + size), 1, 1,
+                     PAGE_HYPERVISOR_NOCACHE) + offs;
+}
+
 /*
  * Important Safety Note:  The fixed ACPI page numbers are *subtracted*
  * from the fixed base.  That's why we start at FIX_ACPI_END and
diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
index a2fc8c4..e2dda2e 100644
--- a/xen/drivers/acpi/osl.c
+++ b/xen/drivers/acpi/osl.c
@@ -88,16 +88,8 @@ acpi_physical_address __init
acpi_os_get_root_pointer(void)
 void __iomem *
 acpi_os_map_memory(acpi_physical_address phys, acpi_size size)
 {
-       if (system_state >= SYS_STATE_active) {
-               mfn_t mfn = _mfn(PFN_DOWN(phys));
-               unsigned int offs = phys & (PAGE_SIZE - 1);
-
-               /* The low first Mb is always mapped. */
-               if ( !((phys + size - 1) >> 20) )
-                       return __va(phys);
-               return __vmap(&mfn, PFN_UP(offs + size), 1, 1,
-                             PAGE_HYPERVISOR_NOCACHE) + offs;
-       }
+       if (system_state >= SYS_STATE_active)
+               return arch_acpi_os_map_memory(phys, size);
        return __acpi_map_table(phys, size);
 }


-- 
Shannon

  reply	other threads:[~2016-01-22  8:38 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-16  5:01 [PATCH v4 00/10] Refactor DT specific codes preparing for ACPI support on ARM64 Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 01/10] ACPI: check acpi_disabled in acpi_table_parse() and acpi_table_parse_entries() Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 02/10] ACPI / table: Add new function to get table entries Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 03/10] acpi/pmstat: Build pmstat for x86 only Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 04/10] acpi: Don't do traditional BIOS table scan for ARM64 Shannon Zhao
2016-01-18 13:29   ` Jan Beulich
2016-01-19  3:46     ` Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 05/10] acpi: Refactor acpi_os_map_memory to be architecturally independent Shannon Zhao
2016-01-18 13:33   ` Jan Beulich
2016-01-22  8:38     ` Shannon Zhao [this message]
2016-01-22  8:47       ` Jan Beulich
2016-01-22  9:37         ` Shannon Zhao
2016-01-22 10:15           ` Jan Beulich
2016-01-22 11:55             ` Shannon Zhao
2016-01-22 12:30               ` Jan Beulich
2016-01-16  5:01 ` [PATCH v4 06/10] arm/smpboot: Move dt specific code in smp to seperate functions Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 07/10] arm/gic-v2: Refactor gicv2_init into generic and dt specific parts Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 08/10] arm/gic-v3: Refactor gicv3_init " Shannon Zhao
2016-01-16  5:01 ` [PATCH v4 09/10] arm/uart: Rename dt-uart.c to arm-uart.c Shannon Zhao
2016-01-18 10:40   ` Jan Beulich
2016-01-19  3:36     ` Shannon Zhao
2016-01-19  8:39       ` Jan Beulich
2016-01-19  8:43         ` Shannon Zhao
2016-01-19  8:50           ` Jan Beulich
2016-01-16  5:01 ` [PATCH v4 10/10] pl011: Refactor pl011 driver to dt and common initialization parts 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=56A1EA87.5050404@huawei.com \
    --to=zhaoshenglong@huawei.com \
    --cc=JBeulich@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=julien.grall@citrix.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=shannon.zhao@linaro.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.