clean up physical merging helpers
Subsystems (6)
Hi Jens,
this series moves Xen special handling of block merges from arch hooks into common code. A previous version has been reviewed by Boris.
PATCH 1/5 arm: remove the unused BIOVEC_MERGEABLE define
--- arch/arm/include/asm/io.h | 7 ------- 1 file changed, 7 deletions(-)
arch/arm/include/asm/io.h +0 -7
@@ -459,13 +459,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);#include <asm-generic/io.h> -/* -* can the hardware map this into one segment or not, given no other -* constraints. -*/ -#define BIOVEC_MERGEABLE (vec1, vec2) \ - ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2))) -struct bio_vec ;extern bool xen_biovec_phys_mergeable (const struct bio_vec *vec1,const struct bio_vec *vec2);
Signature · 1 line
2.19.0
PATCH 2/5 xen: remove the xen_biovec_phys_mergeable export
In reply to Christoph HellwigBIOVEC_PHYS_MERGEABLE is only called from core block code.
--- drivers/xen/biomerge.c | 1 - 1 file changed, 1 deletion(-)
drivers/xen/biomerge.c +0 -1
@@ -20,4 +20,3 @@ bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,return false;#endif } -EXPORT_SYMBOL (xen_biovec_phys_mergeable);
Signature · 1 line
2.19.0
PATCH 3/5 xen: provide a prototype for xen_biovec_phys_mergeable in xen.h
In reply to Christoph HellwigHaving multiple externs in arch headers is not a good way to provide a common interface.
--- arch/arm/include/asm/io.h | 3 --- arch/arm64/include/asm/io.h | 3 --- arch/x86/include/asm/io.h | 4 ---- include/xen/xen.h | 4 ++++ 4 files changed, 4 insertions(+), 10 deletions(-)
arch/arm/include/asm/io.h +0 -3
@@ -459,9 +459,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);#include <asm-generic/io.h> -struct bio_vec ; -extern bool xen_biovec_phys_mergeable (const struct bio_vec *vec1, -const struct bio_vec *vec2);#define ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2) \ (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2))
arch/arm64/include/asm/io.h +0 -3
@@ -205,9 +205,6 @@ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);extern int devmem_is_allowed (unsigned long pfn); -struct bio_vec ; -extern bool xen_biovec_phys_mergeable (const struct bio_vec *vec1, -const struct bio_vec *vec2);#define ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2) \ (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2))
arch/x86/include/asm/io.h +0 -4
@@ -371,10 +371,6 @@ extern bool is_early_ioremap_ptep(pte_t *ptep);#ifdef CONFIG_XEN #include <xen/xen.h> -struct bio_vec ; - -extern bool xen_biovec_phys_mergeable (const struct bio_vec *vec1, -const struct bio_vec *vec2);#define ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2) \ (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2))
include/xen/xen.h +4 -0
@@ -39,4 +39,8 @@ extern uint32_t xen_start_flags;#define xen_initial_domain () (0)#endif /* CONFIG_XEN_DOM0 */ +struct bio_vec ; +bool xen_biovec_phys_mergeable (const struct bio_vec *vec1, +const struct bio_vec *vec2); +#endif /* _XEN_XEN_H */
Signature · 1 line
2.19.0
PATCH 4/5 block: remove ARCH_BIOVEC_PHYS_MERGEABLE
In reply to Christoph HellwigTake the Xen check into the core code instead of delegating it to the architectures.
--- arch/arm/include/asm/io.h | 3 --- arch/arm64/include/asm/io.h | 3 --- arch/x86/include/asm/io.h | 3 --- block/blk.h | 7 ++----- drivers/xen/biomerge.c | 2 +- 5 files changed, 3 insertions(+), 15 deletions(-)
arch/arm/include/asm/io.h +0 -3
@@ -459,9 +459,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr);#include <asm-generic/io.h> -#define ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2) \ - (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)) -#ifdef CONFIG_MMU #define ARCH_HAS_VALID_PHYS_ADDR_RANGE extern int valid_phys_addr_range (phys_addr_t addr,size_t size);
arch/arm64/include/asm/io.h +0 -3
@@ -205,8 +205,5 @@ extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);extern int devmem_is_allowed (unsigned long pfn); -#define ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2) \ - (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)) -#endif /* __KERNEL__ */ #endif /* __ASM_IO_H */
arch/x86/include/asm/io.h +0 -3
@@ -371,9 +371,6 @@ extern bool is_early_ioremap_ptep(pte_t *ptep);#ifdef CONFIG_XEN #include <xen/xen.h> - -#define ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2) \ - (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2))#endif /* CONFIG_XEN */ #define IO_SPACE_LIMIT 0xffff
block/blk.h +2 -5
@@ -4,6 +4,7 @@#include <linux/idr.h> #include <linux/blk-mq.h> +#include <xen/xen.h> #include "blk-mq.h" /* Amount of time in which a process may batch requests */
@@ -149,10 +150,6 @@ static inline void blk_queue_enter_live(struct request_queue *q)percpu_ref_get (&q->q_usage_counter); } -#ifndef ARCH_BIOVEC_PHYS_MERGEABLE -#define ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2) true -#endif -static inline bool biovec_phys_mergeable (struct request_queue *q,struct bio_vec *vec1,struct bio_vec *vec2) {
@@ -162,7 +159,7 @@ static inline bool biovec_phys_mergeable(struct request_queue *q,if (addr1 + vec1->bv_len != addr2)return false; -if (!ARCH_BIOVEC_PHYS_MERGEABLE (vec1, vec2)) +if (xen_domain () && !xen_biovec_phys_mergeable (vec1, vec2))return false;if ((addr1 | mask) != ((addr2 + vec2->bv_len -1 ) | mask))return false;
drivers/xen/biomerge.c +1 -1
@@ -1,7 +1,7 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/bio.h> -#include <linux/io.h> #include <linux/export.h> +#include <xen/xen.h> #include <xen/page.h> bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
Signature · 1 line
2.19.0
PATCH 5/5 xen: don't include <xen/xen.h> from <asm/io.h> and <asm/dma-mapping.h>
In reply to Christoph HellwigNothing Xen specific in these headers, which get included from a lot of code in the kernel. So prune the includes and move them to the Xen-specific files that actually use them instead.
--- arch/arm/include/asm/io.h | 1 - arch/arm64/include/asm/io.h | 2 -- arch/x86/include/asm/io.h | 4 ---- arch/x86/include/asm/xen/events.h | 2 ++ arch/x86/xen/enlighten.c | 1 + arch/x86/xen/enlighten_pvh.c | 1 + arch/x86/xen/platform-pci-unplug.c | 1 + arch/x86/xen/pmu.c | 1 + drivers/xen/xen-acpi-pad.c | 1 + 9 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/include/asm/io.h +0 -1
@@ -28,7 +28,6 @@#include <asm/byteorder.h> #include <asm/memory.h> #include <asm-generic/pci_iomap.h> -#include <xen/xen.h> /* * ISA I/O bus memory addresses are 1:1 with the physical address.
arch/arm64/include/asm/io.h +0 -2
@@ -31,8 +31,6 @@#include <asm/alternative.h> #include <asm/cpufeature.h> -#include <xen/xen.h> -/* * Generic IO read/write. These perform native-endian accesses. */
arch/x86/include/asm/io.h +0 -4
@@ -369,10 +369,6 @@ extern void __iomem *ioremap_wt(resource_size_t offset, unsigned long size);extern bool is_early_ioremap_ptep (pte_t *ptep); -#ifdef CONFIG_XEN -#include <xen/xen.h> -#endif /* CONFIG_XEN */ -#define IO_SPACE_LIMIT 0xffff#include <asm-generic/io.h>
arch/x86/include/asm/xen/events.h +2 -0
@@ -2,6 +2,8 @@#ifndef _ASM_X86_XEN_EVENTS_H#define _ASM_X86_XEN_EVENTS_H +#include <xen/xen.h> +enum ipi_vector {XEN_RESCHEDULE_VECTOR , XEN_CALL_FUNCTION_VECTOR,
arch/x86/xen/enlighten.c +1 -0
@@ -5,6 +5,7 @@#include <linux/kexec.h> #include <linux/slab.h> +#include <xen/xen.h> #include <xen/features.h> #include <xen/page.h> #include <xen/interface/memory.h>
arch/x86/xen/enlighten_pvh.c +1 -0
@@ -11,6 +11,7 @@#include <asm/xen/interface.h> #include <asm/xen/hypercall.h> +#include <xen/xen.h> #include <xen/interface/memory.h> #include <xen/interface/hvm/start_info.h>
arch/x86/xen/platform-pci-unplug.c +1 -0
@@ -23,6 +23,7 @@#include <linux/io.h> #include <linux/export.h> +#include <xen/xen.h> #include <xen/platform_pci.h> #include "xen-ops.h"
arch/x86/xen/pmu.c +1 -0
@@ -3,6 +3,7 @@#include <linux/interrupt.h> #include <asm/xen/hypercall.h> +#include <xen/xen.h> #include <xen/page.h> #include <xen/interface/xen.h> #include <xen/interface/vcpu.h>
drivers/xen/xen-acpi-pad.c +1 -0
@@ -19,6 +19,7 @@#include <linux/kernel.h> #include <linux/types.h> #include <linux/acpi.h> +#include <xen/xen.h> #include <xen/interface/version.h> #include <xen/xen-ops.h> #include <asm/xen/hypercall.h>
Signature · 1 line
2.19.0
Quoted 4 lines · Christoph Hellwig
Hi Jens,
this series moves Xen special handling of block merges from arch hooks into common code. A previous version has been reviewed by Boris.
Applied, thanks.
Signature · 1 line
Jens Axboe