All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] arm/acpi: Add __acpi_unmap_table function for ARM
@ 2020-01-21  9:49 Wei Xu
  2020-01-21 10:01 ` Alexandru Stefan ISAILA
  2020-01-21 11:02 ` Jan Beulich
  0 siblings, 2 replies; 9+ messages in thread
From: Wei Xu @ 2020-01-21  9:49 UTC (permalink / raw)
  To: xen-devel
  Cc: Stefano Stabellini, Julien Grall, Zengtao (B), Wei Liu,
	Konrad Rzeszutek Wilk, George Dunlap, Andrew Cooper, Ian Jackson,
	Linuxarm, Shameerali Kolothum Thodi, xuwei5, Jan Beulich,
	Volodymyr_Babchuk


[-- Attachment #1.1: Type: text/plain, Size: 2248 bytes --]

Add __acpi_unmap_table function for ARM and invoke it at acpi_os_unmap_memory
to make sure the related fixmap has been cleared before using it for a
different mapping.

Signed-off-by: Wei Xu<xuwei5@hisilicon.com>
---
  xen/arch/arm/acpi/lib.c | 25 +++++++++++++++++++++++++
  xen/drivers/acpi/osl.c  |  2 ++
  xen/include/xen/acpi.h  |  1 +
  3 files changed, 28 insertions(+)

diff --git a/xen/arch/arm/acpi/lib.c b/xen/arch/arm/acpi/lib.c
index 4fc6e17..69e87ec 100644
--- a/xen/arch/arm/acpi/lib.c
+++ b/xen/arch/arm/acpi/lib.c
@@ -49,6 +49,31 @@ char *__acpi_map_table(paddr_t phys, unsigned long size)
      return ((char *) base + offset);
  }
  
+void __acpi_unmap_table(void __iomem * virt, unsigned long size)
+{
+    unsigned long base, end;
+    int idx;
+
+    base = FIXMAP_ADDR(FIXMAP_ACPI_BEGIN);
+    end = FIXMAP_ADDR(FIXMAP_ACPI_END);
+
+    if ( (unsigned long)virt < base || (unsigned long)virt > end )
+    {
+        return;
+    }
+
+    idx = FIXMAP_ACPI_BEGIN + ((unsigned long)virt - base) / PAGE_SIZE;
+    clear_fixmap(idx);
+
+    while ( size > PAGE_SIZE )
+    {
+        if ( ++idx > FIXMAP_ACPI_END )
+            return;
+        clear_fixmap(idx);
+        size -= PAGE_SIZE;
+    }
+}
+
  /* True to indicate PSCI 0.2+ is implemented */
  bool __init acpi_psci_present(void)
  {
diff --git a/xen/drivers/acpi/osl.c b/xen/drivers/acpi/osl.c
index 4c8bb78..18666c7 100644
--- a/xen/drivers/acpi/osl.c
+++ b/xen/drivers/acpi/osl.c
@@ -114,6 +114,8 @@ void acpi_os_unmap_memory(void __iomem * virt, acpi_size size)
  		return;
  	}
  
+	__acpi_unmap_table(virt, size);
+
  	if (system_state >= SYS_STATE_boot)
  		vunmap((void *)((unsigned long)virt & PAGE_MASK));
  }
diff --git a/xen/include/xen/acpi.h b/xen/include/xen/acpi.h
index 5cfa060..acb00a2 100644
--- a/xen/include/xen/acpi.h
+++ b/xen/include/xen/acpi.h
@@ -68,6 +68,7 @@ typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, co
  
  unsigned int acpi_get_processor_id (unsigned int cpu);
  char * __acpi_map_table (paddr_t phys_addr, unsigned long size);
+void __acpi_unmap_table(void __iomem * virt, unsigned long size);
  int acpi_boot_init (void);
  int acpi_boot_table_init (void);
  int acpi_numa_init (void);
-- 2.8.1 .


[-- Attachment #1.2: Type: text/html, Size: 2695 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-01-22  9:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-21  9:49 [Xen-devel] [PATCH] arm/acpi: Add __acpi_unmap_table function for ARM Wei Xu
2020-01-21 10:01 ` Alexandru Stefan ISAILA
2020-01-22  1:51   ` Wei Xu
2020-01-21 11:02 ` Jan Beulich
2020-01-21 11:25   ` Julien Grall
2020-01-22  5:58     ` Wei Xu
2020-01-22  5:57   ` Wei Xu
2020-01-22  8:24     ` Jan Beulich
2020-01-22  9:04       ` Wei Xu

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.