diff mbox series

[kvmtool,2/6] Add __KERNEL_DIV_ROUND_UP() macro

Message ID 20250127132424.339957-3-apatel@ventanamicro.com
State Accepted
Headers show
Series Add RISC-V ISA extensions based on Linux-6.13 | expand

Commit Message

Anup Patel Jan. 27, 2025, 1:24 p.m. UTC
The latest virtio_pci.h header from Linux-6.13 kernel requires
__KERNEL_DIV_ROUND_UP() macro so define it conditionally in
linux/kernel.h.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
---
 include/linux/kernel.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Will Deacon Feb. 11, 2025, 11:40 a.m. UTC | #1
On Mon, Jan 27, 2025 at 06:54:20PM +0530, Anup Patel wrote:
> The latest virtio_pci.h header from Linux-6.13 kernel requires
> __KERNEL_DIV_ROUND_UP() macro so define it conditionally in
> linux/kernel.h.
> 
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> ---
>  include/linux/kernel.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 6c22f1c..df42d63 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -8,6 +8,9 @@
>  #define round_down(x, y)	((x) & ~__round_mask(x, y))
>  
>  #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> +#ifndef __KERNEL_DIV_ROUND_UP
> +#define __KERNEL_DIV_ROUND_UP(n,d)	DIV_ROUND_UP(n,d)
> +#endif

I'm happy to take this for now, but perhaps we should be pulling
in the uapi const.h header instead of rolling this ourselves? Ideally,
kernel.h would disappear altogether.

Will
Anup Patel Feb. 11, 2025, 11:58 a.m. UTC | #2
On Tue, Feb 11, 2025 at 5:10 PM Will Deacon <will@kernel.org> wrote:
>
> On Mon, Jan 27, 2025 at 06:54:20PM +0530, Anup Patel wrote:
> > The latest virtio_pci.h header from Linux-6.13 kernel requires
> > __KERNEL_DIV_ROUND_UP() macro so define it conditionally in
> > linux/kernel.h.
> >
> > Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> > ---
> >  include/linux/kernel.h | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > index 6c22f1c..df42d63 100644
> > --- a/include/linux/kernel.h
> > +++ b/include/linux/kernel.h
> > @@ -8,6 +8,9 @@
> >  #define round_down(x, y)     ((x) & ~__round_mask(x, y))
> >
> >  #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
> > +#ifndef __KERNEL_DIV_ROUND_UP
> > +#define __KERNEL_DIV_ROUND_UP(n,d)   DIV_ROUND_UP(n,d)
> > +#endif
>
> I'm happy to take this for now, but perhaps we should be pulling
> in the uapi const.h header instead of rolling this ourselves? Ideally,
> kernel.h would disappear altogether.
>

Sure, next time I will try to pull the uapi const.h header into kvmtool.

Thanks,
Anup
diff mbox series

Patch

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 6c22f1c..df42d63 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -8,6 +8,9 @@ 
 #define round_down(x, y)	((x) & ~__round_mask(x, y))
 
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
+#ifndef __KERNEL_DIV_ROUND_UP
+#define __KERNEL_DIV_ROUND_UP(n,d)	DIV_ROUND_UP(n,d)
+#endif
 
 #define ALIGN(x,a)		__ALIGN_MASK(x,(typeof(x))(a)-1)
 #define __ALIGN_MASK(x,mask)	(((x)+(mask))&~(mask))