From 6a9f5f240adfdced863a098d34f8f05ca6ab9d5f Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Mon, 24 Sep 2018 09:43:50 +0200 Subject: block: simplify BIOVEC_PHYS_MERGEABLE Turn the macro into an inline, move it to blk.h and simplify the arch hooks a bit. Also rename the function to biovec_phys_mergeable as there is no need to shout. Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- arch/arm64/include/asm/io.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'arch/arm64/include') diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 35b2e50f17fb..774e03ea1bb0 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -208,9 +208,8 @@ 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 BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ - (__BIOVEC_PHYS_MERGEABLE(vec1, vec2) && \ - (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2))) +#define ARCH_BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ + (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)) #endif /* __KERNEL__ */ #endif /* __ASM_IO_H */ -- cgit v1.2.3 From 20e3267601f95ff62d7a3116a17a680e9f5cbcc9 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 25 Sep 2018 13:30:07 -0700 Subject: xen: provide a prototype for xen_biovec_phys_mergeable in xen.h Having multiple externs in arch headers is not a good way to provide a common interface. Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- 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(-) (limited to 'arch/arm64/include') diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index e58ca25eddb7..cf5cd88e7289 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -459,9 +459,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); #include -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)) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 774e03ea1bb0..06119ee511cd 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -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)) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 7c6106216d9c..abdb501a551d 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -371,10 +371,6 @@ extern bool is_early_ioremap_ptep(pte_t *ptep); #ifdef CONFIG_XEN #include -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)) diff --git a/include/xen/xen.h b/include/xen/xen.h index 1e1d9bd0bd37..d7a2678da77f 100644 --- a/include/xen/xen.h +++ b/include/xen/xen.h @@ -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 */ -- cgit v1.2.3 From c39ae60dfbda66922f644193b91850abcd4d588c Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 25 Sep 2018 13:30:08 -0700 Subject: block: remove ARCH_BIOVEC_PHYS_MERGEABLE Take the Xen check into the core code instead of delegating it to the architectures. Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- 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(-) (limited to 'arch/arm64/include') diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index cf5cd88e7289..6ae7674da0d6 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -459,9 +459,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *addr); #include -#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); diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 06119ee511cd..18f6ae6a43f1 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -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 */ diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index abdb501a551d..232d8e9ee8a0 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -371,9 +371,6 @@ extern bool is_early_ioremap_ptep(pte_t *ptep); #ifdef CONFIG_XEN #include - -#define ARCH_BIOVEC_PHYS_MERGEABLE(vec1, vec2) \ - (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)) #endif /* CONFIG_XEN */ #define IO_SPACE_LIMIT 0xffff diff --git a/block/blk.h b/block/blk.h index 50f74ce60453..58c030f727e9 100644 --- a/block/blk.h +++ b/block/blk.h @@ -4,6 +4,7 @@ #include #include +#include #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; diff --git a/drivers/xen/biomerge.c b/drivers/xen/biomerge.c index 399c4e30f723..f3fbb700f569 100644 --- a/drivers/xen/biomerge.c +++ b/drivers/xen/biomerge.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include -#include #include +#include #include bool xen_biovec_phys_mergeable(const struct bio_vec *vec1, -- cgit v1.2.3 From 3cfa210bf3fe0803cca17f3775d8cf2360d5f443 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Tue, 25 Sep 2018 13:30:09 -0700 Subject: xen: don't include from and Nothing 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. Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- 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(-) (limited to 'arch/arm64/include') diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h index 6ae7674da0d6..6b51826ab3d1 100644 --- a/arch/arm/include/asm/io.h +++ b/arch/arm/include/asm/io.h @@ -28,7 +28,6 @@ #include #include #include -#include /* * ISA I/O bus memory addresses are 1:1 with the physical address. diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 18f6ae6a43f1..9f8b915af3a7 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -31,8 +31,6 @@ #include #include -#include - /* * Generic IO read/write. These perform native-endian accesses. */ diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 232d8e9ee8a0..9a92a3ac2ac5 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -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 -#endif /* CONFIG_XEN */ - #define IO_SPACE_LIMIT 0xffff #include diff --git a/arch/x86/include/asm/xen/events.h b/arch/x86/include/asm/xen/events.h index d383140e1dc8..068d9b067c83 100644 --- a/arch/x86/include/asm/xen/events.h +++ b/arch/x86/include/asm/xen/events.h @@ -2,6 +2,8 @@ #ifndef _ASM_X86_XEN_EVENTS_H #define _ASM_X86_XEN_EVENTS_H +#include + enum ipi_vector { XEN_RESCHEDULE_VECTOR, XEN_CALL_FUNCTION_VECTOR, diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 2eeddd814653..0ca46e03b830 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include diff --git a/arch/x86/xen/enlighten_pvh.c b/arch/x86/xen/enlighten_pvh.c index c85d1a88f476..2a9025343534 100644 --- a/arch/x86/xen/enlighten_pvh.c +++ b/arch/x86/xen/enlighten_pvh.c @@ -11,6 +11,7 @@ #include #include +#include #include #include diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c index 33a783c77d96..b99585034dd2 100644 --- a/arch/x86/xen/platform-pci-unplug.c +++ b/arch/x86/xen/platform-pci-unplug.c @@ -23,6 +23,7 @@ #include #include +#include #include #include "xen-ops.h" diff --git a/arch/x86/xen/pmu.c b/arch/x86/xen/pmu.c index 7d00d4ad44d4..5f7d530fc679 100644 --- a/arch/x86/xen/pmu.c +++ b/arch/x86/xen/pmu.c @@ -3,6 +3,7 @@ #include #include +#include #include #include #include diff --git a/drivers/xen/xen-acpi-pad.c b/drivers/xen/xen-acpi-pad.c index 23d1808fe027..e25ab76b9c99 100644 --- a/drivers/xen/xen-acpi-pad.c +++ b/drivers/xen/xen-acpi-pad.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include -- cgit v1.2.3