* [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro
@ 2021-08-03 3:49 Cai Huoqing
2021-08-03 3:49 ` [PATCH 1/4] s390/scm_blk: Make use of PAGE_ALIGN " Cai Huoqing
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-08-03 3:49 UTC (permalink / raw)
To: hca, gor, borntraeger, vneethv, oberpar, cohuck, farman,
mjrosato, pasic, chaitanya.kulkarni, axboe
Cc: linux-s390, kvm, Cai Huoqing
it's a refactor to make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro
Cai Huoqing (4):
s390/scm_blk: Make use of PAGE_ALIGN helper macro
s390/vmcp: Make use of PFN_UP helper macro
vfio-ccw: Make use of PAGE_MASK/PFN_UP helper macro
s390/cio: Make use of PAGE_ALIGN helper macro
drivers/s390/block/scm_blk.c | 2 +-
drivers/s390/char/vmcp.c | 10 ++++------
drivers/s390/cio/itcw.c | 2 +-
drivers/s390/cio/vfio_ccw_cp.c | 8 ++++----
4 files changed, 10 insertions(+), 12 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] s390/scm_blk: Make use of PAGE_ALIGN helper macro
2021-08-03 3:49 [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro Cai Huoqing
@ 2021-08-03 3:49 ` Cai Huoqing
2021-08-03 3:49 ` [PATCH 2/4] s390/vmcp: Make use of PFN_UP " Cai Huoqing
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-08-03 3:49 UTC (permalink / raw)
To: hca, gor, borntraeger, vneethv, oberpar, cohuck, farman,
mjrosato, pasic, chaitanya.kulkarni, axboe
Cc: linux-s390, kvm, Cai Huoqing
it's a refactor to make use of PAGE_ALIGN helper macro
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
drivers/s390/block/scm_blk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 88cba6212ee2..9f17aa38ab45 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -158,7 +158,7 @@ static inline struct aidaw *scm_aidaw_alloc(void)
static inline unsigned long scm_aidaw_bytes(struct aidaw *aidaw)
{
unsigned long _aidaw = (unsigned long) aidaw;
- unsigned long bytes = ALIGN(_aidaw, PAGE_SIZE) - _aidaw;
+ unsigned long bytes = PAGE_ALIGN(_aidaw) - _aidaw;
return (bytes / sizeof(*aidaw)) * PAGE_SIZE;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] s390/vmcp: Make use of PFN_UP helper macro
2021-08-03 3:49 [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro Cai Huoqing
2021-08-03 3:49 ` [PATCH 1/4] s390/scm_blk: Make use of PAGE_ALIGN " Cai Huoqing
@ 2021-08-03 3:49 ` Cai Huoqing
2021-08-03 3:49 ` [PATCH 3/4] vfio-ccw: Make use of PAGE_MASK/PFN_UP " Cai Huoqing
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-08-03 3:49 UTC (permalink / raw)
To: hca, gor, borntraeger, vneethv, oberpar, cohuck, farman,
mjrosato, pasic, chaitanya.kulkarni, axboe
Cc: linux-s390, kvm, Cai Huoqing
it's a refactor to make use of PFN_UP helper macro
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
drivers/s390/char/vmcp.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/s390/char/vmcp.c b/drivers/s390/char/vmcp.c
index 9e066281e2d0..3f83eb6b9e5b 100644
--- a/drivers/s390/char/vmcp.c
+++ b/drivers/s390/char/vmcp.c
@@ -60,17 +60,16 @@ void __init vmcp_cma_reserve(void)
static void vmcp_response_alloc(struct vmcp_session *session)
{
struct page *page = NULL;
- int nr_pages, order;
+ int order;
order = get_order(session->bufsize);
- nr_pages = ALIGN(session->bufsize, PAGE_SIZE) >> PAGE_SHIFT;
/*
* For anything below order 3 allocations rely on the buddy
* allocator. If such low-order allocations can't be handled
* anymore the system won't work anyway.
*/
if (order > 2)
- page = cma_alloc(vmcp_cma, nr_pages, 0, false);
+ page = cma_alloc(vmcp_cma, PFN_UP(session->bufsize), 0, false);
if (page) {
session->response = (char *)page_to_phys(page);
session->cma_alloc = 1;
@@ -81,16 +80,15 @@ static void vmcp_response_alloc(struct vmcp_session *session)
static void vmcp_response_free(struct vmcp_session *session)
{
- int nr_pages, order;
+ int order;
struct page *page;
if (!session->response)
return;
order = get_order(session->bufsize);
- nr_pages = ALIGN(session->bufsize, PAGE_SIZE) >> PAGE_SHIFT;
if (session->cma_alloc) {
page = phys_to_page((unsigned long)session->response);
- cma_release(vmcp_cma, page, nr_pages);
+ cma_release(vmcp_cma, page, PFN_UP(session->bufsize));
session->cma_alloc = 0;
} else {
free_pages((unsigned long)session->response, order);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] vfio-ccw: Make use of PAGE_MASK/PFN_UP helper macro
2021-08-03 3:49 [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro Cai Huoqing
2021-08-03 3:49 ` [PATCH 1/4] s390/scm_blk: Make use of PAGE_ALIGN " Cai Huoqing
2021-08-03 3:49 ` [PATCH 2/4] s390/vmcp: Make use of PFN_UP " Cai Huoqing
@ 2021-08-03 3:49 ` Cai Huoqing
2021-08-03 3:49 ` [PATCH 4/4] s390/cio: Make use of PAGE_ALIGN " Cai Huoqing
2021-08-03 8:34 ` [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP " Heiko Carstens
4 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-08-03 3:49 UTC (permalink / raw)
To: hca, gor, borntraeger, vneethv, oberpar, cohuck, farman,
mjrosato, pasic, chaitanya.kulkarni, axboe
Cc: linux-s390, kvm, Cai Huoqing
it's a refactor to make use of PAGE_MASK/PFN_UP helper macro
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
drivers/s390/cio/vfio_ccw_cp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
index 8d1b2771c1aa..178ff71d5cfd 100644
--- a/drivers/s390/cio/vfio_ccw_cp.c
+++ b/drivers/s390/cio/vfio_ccw_cp.c
@@ -65,7 +65,7 @@ static int pfn_array_alloc(struct pfn_array *pa, u64 iova, unsigned int len)
pa->pa_iova = iova;
- pa->pa_nr = ((iova & ~PAGE_MASK) + len + (PAGE_SIZE - 1)) >> PAGE_SHIFT;
+ pa->pa_nr = PFN_UP((iova & ~PAGE_MASK) + len);
if (!pa->pa_nr)
return -EINVAL;
@@ -161,7 +161,7 @@ static inline void pfn_array_idal_create_words(
idaws[i] = pa->pa_pfn[i] << PAGE_SHIFT;
/* Adjust the first IDAW, since it may not start on a page boundary */
- idaws[0] += pa->pa_iova & (PAGE_SIZE - 1);
+ idaws[0] += pa->pa_iova & ~PAGE_MASK;
}
static void convert_ccw0_to_ccw1(struct ccw1 *source, unsigned long len)
@@ -214,8 +214,8 @@ static long copy_from_iova(struct device *mdev,
from = pa.pa_pfn[i] << PAGE_SHIFT;
m = PAGE_SIZE;
if (i == 0) {
- from += iova & (PAGE_SIZE - 1);
- m -= iova & (PAGE_SIZE - 1);
+ from += iova & ~PAGE_SIZE;
+ m -= iova & ~PAGE_MASK;
}
m = min(l, m);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] s390/cio: Make use of PAGE_ALIGN helper macro
2021-08-03 3:49 [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro Cai Huoqing
` (2 preceding siblings ...)
2021-08-03 3:49 ` [PATCH 3/4] vfio-ccw: Make use of PAGE_MASK/PFN_UP " Cai Huoqing
@ 2021-08-03 3:49 ` Cai Huoqing
2021-08-03 8:34 ` [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP " Heiko Carstens
4 siblings, 0 replies; 6+ messages in thread
From: Cai Huoqing @ 2021-08-03 3:49 UTC (permalink / raw)
To: hca, gor, borntraeger, vneethv, oberpar, cohuck, farman,
mjrosato, pasic, chaitanya.kulkarni, axboe
Cc: linux-s390, kvm, Cai Huoqing
it's a refactor to make use of PAGE_ALIGN helper macro
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
drivers/s390/cio/itcw.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/s390/cio/itcw.c b/drivers/s390/cio/itcw.c
index 19e46363348c..4f9e810e287c 100644
--- a/drivers/s390/cio/itcw.c
+++ b/drivers/s390/cio/itcw.c
@@ -141,7 +141,7 @@ static inline void *fit_chunk(addr_t *start, addr_t end, size_t len,
addr = ALIGN(*start, align);
if (check_4k && CROSS4K(addr, len)) {
- addr = ALIGN(addr, 4096);
+ addr = PAGE_ALIGN(addr);
addr = ALIGN(addr, align);
}
if (addr + len > end)
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro
2021-08-03 3:49 [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro Cai Huoqing
` (3 preceding siblings ...)
2021-08-03 3:49 ` [PATCH 4/4] s390/cio: Make use of PAGE_ALIGN " Cai Huoqing
@ 2021-08-03 8:34 ` Heiko Carstens
4 siblings, 0 replies; 6+ messages in thread
From: Heiko Carstens @ 2021-08-03 8:34 UTC (permalink / raw)
To: Cai Huoqing
Cc: gor, borntraeger, vneethv, oberpar, cohuck, farman, mjrosato,
pasic, chaitanya.kulkarni, axboe, linux-s390, kvm
On Tue, Aug 03, 2021 at 11:49:00AM +0800, Cai Huoqing wrote:
> it's a refactor to make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro
>
> Cai Huoqing (4):
> s390/scm_blk: Make use of PAGE_ALIGN helper macro
> s390/vmcp: Make use of PFN_UP helper macro
> vfio-ccw: Make use of PAGE_MASK/PFN_UP helper macro
> s390/cio: Make use of PAGE_ALIGN helper macro
>
> drivers/s390/block/scm_blk.c | 2 +-
> drivers/s390/char/vmcp.c | 10 ++++------
> drivers/s390/cio/itcw.c | 2 +-
> drivers/s390/cio/vfio_ccw_cp.c | 8 ++++----
> 4 files changed, 10 insertions(+), 12 deletions(-)
I'm not willing to review or apply these patches. There is no added
value and I doubt that anything of this has been tested, so you are
putting the burden on other people.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-08-03 8:34 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 3:49 [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP helper macro Cai Huoqing
2021-08-03 3:49 ` [PATCH 1/4] s390/scm_blk: Make use of PAGE_ALIGN " Cai Huoqing
2021-08-03 3:49 ` [PATCH 2/4] s390/vmcp: Make use of PFN_UP " Cai Huoqing
2021-08-03 3:49 ` [PATCH 3/4] vfio-ccw: Make use of PAGE_MASK/PFN_UP " Cai Huoqing
2021-08-03 3:49 ` [PATCH 4/4] s390/cio: Make use of PAGE_ALIGN " Cai Huoqing
2021-08-03 8:34 ` [PATCH 0/4] s390: Make use of PAGE_ALIGN/PAGE_MASK/PFN_UP " Heiko Carstens
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).