linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the kvm-riscv tree with the risc-v tree
@ 2023-10-30  1:53 Stephen Rothwell
  2023-11-01  2:37 ` Stephen Rothwell
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2023-10-30  1:53 UTC (permalink / raw)
  To: Anup Patel, Palmer Dabbelt, Paul Walmsley
  Cc: Andrew Jones, Linux Kernel Mailing List, Linux Next Mailing List,
	Mayuresh Chitale, Palmer Dabbelt

[-- Attachment #1: Type: text/plain, Size: 833 bytes --]

Hi all,

Today's linux-next merge of the kvm-riscv tree got a conflict in:

  arch/riscv/include/asm/csr.h

between commit:

  43c16d51a19b ("RISC-V: Enable cbo.zero in usermode")

from the risc-v tree and commits:

  db3c01c7a308 ("RISCV: KVM: Add senvcfg context save/restore")
  81f0f314fec9 ("RISCV: KVM: Add sstateen0 context save/restore")

from the kvm-riscv tree.

I fixed it up (I just used the latter version of this file) and can
carry the fix as necessary. This is now fixed as far as linux-next is
concerned, but any non trivial conflicts should be mentioned to your
upstream maintainer when your tree is submitted for merging.  You may
also want to consider cooperating with the maintainer of the conflicting
tree to minimise any particularly complex conflicts.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: manual merge of the kvm-riscv tree with the risc-v tree
  2023-10-30  1:53 linux-next: manual merge of the kvm-riscv tree with the risc-v tree Stephen Rothwell
@ 2023-11-01  2:37 ` Stephen Rothwell
  2023-11-05 22:31   ` Stephen Rothwell
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2023-11-01  2:37 UTC (permalink / raw)
  To: Palmer Dabbelt, Paul Walmsley
  Cc: Anup Patel, Andrew Jones, Linux Kernel Mailing List,
	Linux Next Mailing List, Mayuresh Chitale, Palmer Dabbelt,
	Paolo Bonzini, KVM

[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]

Hi all,

On Mon, 30 Oct 2023 12:53:02 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the kvm-riscv tree got a conflict in:
> 
>   arch/riscv/include/asm/csr.h
> 
> between commit:
> 
>   43c16d51a19b ("RISC-V: Enable cbo.zero in usermode")
> 
> from the risc-v tree and commits:
> 
>   db3c01c7a308 ("RISCV: KVM: Add senvcfg context save/restore")
>   81f0f314fec9 ("RISCV: KVM: Add sstateen0 context save/restore")
> 
> from the kvm-riscv tree.
> 
> I fixed it up (I just used the latter version of this file) and can
> carry the fix as necessary. This is now fixed as far as linux-next is
> concerned, but any non trivial conflicts should be mentioned to your
> upstream maintainer when your tree is submitted for merging.  You may
> also want to consider cooperating with the maintainer of the conflicting
> tree to minimise any particularly complex conflicts.

This is now a conflict between the kvm tree and the risc-v tree.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: manual merge of the kvm-riscv tree with the risc-v tree
  2023-11-01  2:37 ` Stephen Rothwell
@ 2023-11-05 22:31   ` Stephen Rothwell
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Rothwell @ 2023-11-05 22:31 UTC (permalink / raw)
  To: Palmer Dabbelt, Paul Walmsley
  Cc: Anup Patel, Andrew Jones, Linux Kernel Mailing List,
	Linux Next Mailing List, Mayuresh Chitale, Palmer Dabbelt,
	Paolo Bonzini, KVM

[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]

Hi all,

On Wed, 1 Nov 2023 13:37:43 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> On Mon, 30 Oct 2023 12:53:02 +1100 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > Today's linux-next merge of the kvm-riscv tree got a conflict in:
> > 
> >   arch/riscv/include/asm/csr.h
> > 
> > between commit:
> > 
> >   43c16d51a19b ("RISC-V: Enable cbo.zero in usermode")
> > 
> > from the risc-v tree and commits:
> > 
> >   db3c01c7a308 ("RISCV: KVM: Add senvcfg context save/restore")
> >   81f0f314fec9 ("RISCV: KVM: Add sstateen0 context save/restore")
> > 
> > from the kvm-riscv tree.
> > 
> > I fixed it up (I just used the latter version of this file) and can
> > carry the fix as necessary. This is now fixed as far as linux-next is
> > concerned, but any non trivial conflicts should be mentioned to your
> > upstream maintainer when your tree is submitted for merging.  You may
> > also want to consider cooperating with the maintainer of the conflicting
> > tree to minimise any particularly complex conflicts.  
> 
> This is now a conflict between the kvm tree and the risc-v tree.

This is now a conflict between the risc-v tree and Linus' tree.
-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: manual merge of the kvm-riscv tree with the risc-v tree
  2023-06-20  2:45 Stephen Rothwell
@ 2023-07-03  0:55 ` Stephen Rothwell
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Rothwell @ 2023-07-03  0:55 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Anup Patel, Palmer Dabbelt, Paul Walmsley, Andy Chiu, Anup Patel,
	Greentime Hu, Linux Kernel Mailing List, Linux Next Mailing List,
	Vincent Chen, KVM

[-- Attachment #1: Type: text/plain, Size: 4974 bytes --]

Hi all,

On Tue, 20 Jun 2023 12:45:33 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> 
> Today's linux-next merge of the kvm-riscv tree got a conflict in:
> 
>   arch/riscv/include/uapi/asm/kvm.h
> 
> between commit:
> 
>   bf78f1ea6e51 ("riscv: kvm: Add V extension to KVM ISA")
> 
> from the risc-v tree and commit:
> 
>   3177011788ee ("RISC-V: KVM: Allow Svnapot extension for Guest/VM")
> 
> from the kvm-riscv tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> 
> diff --cc arch/riscv/include/uapi/asm/kvm.h
> index 855c047e86d4,a1ca18408bbd..000000000000
> --- a/arch/riscv/include/uapi/asm/kvm.h
> +++ b/arch/riscv/include/uapi/asm/kvm.h
> @@@ -121,7 -122,7 +122,8 @@@ enum KVM_RISCV_ISA_EXT_ID 
>   	KVM_RISCV_ISA_EXT_ZICBOZ,
>   	KVM_RISCV_ISA_EXT_ZBB,
>   	KVM_RISCV_ISA_EXT_SSAIA,
>  +	KVM_RISCV_ISA_EXT_V,
> + 	KVM_RISCV_ISA_EXT_SVNAPOT,
>   	KVM_RISCV_ISA_EXT_MAX,
>   };
>   
> @@@ -204,13 -205,77 +206,84 @@@ enum KVM_RISCV_SBI_EXT_ID 
>   #define KVM_REG_RISCV_SBI_MULTI_REG_LAST	\
>   		KVM_REG_RISCV_SBI_MULTI_REG(KVM_RISCV_SBI_EXT_MAX - 1)
>   
>  +/* V extension registers are mapped as type 9 */
>  +#define KVM_REG_RISCV_VECTOR		(0x09 << KVM_REG_RISCV_TYPE_SHIFT)
>  +#define KVM_REG_RISCV_VECTOR_CSR_REG(name)	\
>  +		(offsetof(struct __riscv_v_ext_state, name) / sizeof(unsigned long))
>  +#define KVM_REG_RISCV_VECTOR_REG(n)	\
>  +		((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long))
>  +
> + /* Device Control API: RISC-V AIA */
> + #define KVM_DEV_RISCV_APLIC_ALIGN		0x1000
> + #define KVM_DEV_RISCV_APLIC_SIZE		0x4000
> + #define KVM_DEV_RISCV_APLIC_MAX_HARTS		0x4000
> + #define KVM_DEV_RISCV_IMSIC_ALIGN		0x1000
> + #define KVM_DEV_RISCV_IMSIC_SIZE		0x1000
> + 
> + #define KVM_DEV_RISCV_AIA_GRP_CONFIG		0
> + #define KVM_DEV_RISCV_AIA_CONFIG_MODE		0
> + #define KVM_DEV_RISCV_AIA_CONFIG_IDS		1
> + #define KVM_DEV_RISCV_AIA_CONFIG_SRCS		2
> + #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_BITS	3
> + #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_SHIFT	4
> + #define KVM_DEV_RISCV_AIA_CONFIG_HART_BITS	5
> + #define KVM_DEV_RISCV_AIA_CONFIG_GUEST_BITS	6
> + 
> + /*
> +  * Modes of RISC-V AIA device:
> +  * 1) EMUL (aka Emulation): Trap-n-emulate IMSIC
> +  * 2) HWACCEL (aka HW Acceleration): Virtualize IMSIC using IMSIC guest files
> +  * 3) AUTO (aka Automatic): Virtualize IMSIC using IMSIC guest files whenever
> +  *    available otherwise fallback to trap-n-emulation
> +  */
> + #define KVM_DEV_RISCV_AIA_MODE_EMUL		0
> + #define KVM_DEV_RISCV_AIA_MODE_HWACCEL		1
> + #define KVM_DEV_RISCV_AIA_MODE_AUTO		2
> + 
> + #define KVM_DEV_RISCV_AIA_IDS_MIN		63
> + #define KVM_DEV_RISCV_AIA_IDS_MAX		2048
> + #define KVM_DEV_RISCV_AIA_SRCS_MAX		1024
> + #define KVM_DEV_RISCV_AIA_GROUP_BITS_MAX	8
> + #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MIN	24
> + #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MAX	56
> + #define KVM_DEV_RISCV_AIA_HART_BITS_MAX		16
> + #define KVM_DEV_RISCV_AIA_GUEST_BITS_MAX	8
> + 
> + #define KVM_DEV_RISCV_AIA_GRP_ADDR		1
> + #define KVM_DEV_RISCV_AIA_ADDR_APLIC		0
> + #define KVM_DEV_RISCV_AIA_ADDR_IMSIC(__vcpu)	(1 + (__vcpu))
> + #define KVM_DEV_RISCV_AIA_ADDR_MAX		\
> + 		(1 + KVM_DEV_RISCV_APLIC_MAX_HARTS)
> + 
> + #define KVM_DEV_RISCV_AIA_GRP_CTRL		2
> + #define KVM_DEV_RISCV_AIA_CTRL_INIT		0
> + 
> + /*
> +  * The device attribute type contains the memory mapped offset of the
> +  * APLIC register (range 0x0000-0x3FFF) and it must be 4-byte aligned.
> +  */
> + #define KVM_DEV_RISCV_AIA_GRP_APLIC		3
> + 
> + /*
> +  * The lower 12-bits of the device attribute type contains the iselect
> +  * value of the IMSIC register (range 0x70-0xFF) whereas the higher order
> +  * bits contains the VCPU id.
> +  */
> + #define KVM_DEV_RISCV_AIA_GRP_IMSIC		4
> + #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS	12
> + #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK	\
> + 		((1U << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) - 1)
> + #define KVM_DEV_RISCV_AIA_IMSIC_MKATTR(__vcpu, __isel)	\
> + 		(((__vcpu) << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) | \
> + 		 ((__isel) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK))
> + #define KVM_DEV_RISCV_AIA_IMSIC_GET_ISEL(__attr)	\
> + 		((__attr) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK)
> + #define KVM_DEV_RISCV_AIA_IMSIC_GET_VCPU(__attr)	\
> + 		((__attr) >> KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS)
> + 
> + /* One single KVM irqchip, ie. the AIA */
> + #define KVM_NR_IRQCHIPS			1
> + 
>   #endif
>   
>   #endif /* __LINUX_KVM_RISCV_H */

This is now a conflict between the kvm tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: linux-next: manual merge of the kvm-riscv tree with the risc-v tree
  2023-06-19  2:33 Stephen Rothwell
@ 2023-07-03  0:54 ` Stephen Rothwell
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Rothwell @ 2023-07-03  0:54 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Anup Patel, Palmer Dabbelt, Paul Walmsley, Andy Chiu, Anup Patel,
	Greentime Hu, Linux Kernel Mailing List, Linux Next Mailing List,
	Palmer Dabbelt, Vincent Chen, KVM

[-- Attachment #1: Type: text/plain, Size: 4984 bytes --]

Hi all,

On Mon, 19 Jun 2023 12:33:00 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> Today's linux-next merge of the kvm-riscv tree got a conflict in:
> 
>   arch/riscv/include/uapi/asm/kvm.h
> 
> between commit:
> 
>   0f4b82579716 ("riscv: KVM: Add vector lazy save/restore support")
> 
> from the risc-v tree and commits:
> 
>   00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA irqchip support")
>   89d01306e34d ("RISC-V: KVM: Implement device interface for AIA irqchip")
>   289a007b98b0 ("RISC-V: KVM: Expose APLIC registers as attributes of AIA irqchip")
>   4fe9eadad83b ("RISC-V: KVM: Expose IMSIC registers as attributes of AIA irqchip")
> 
> from the kvm-riscv tree.
> 
> I fixed it up (see below) and can carry the fix as necessary. This
> is now fixed as far as linux-next is concerned, but any non trivial
> conflicts should be mentioned to your upstream maintainer when your tree
> is submitted for merging.  You may also want to consider cooperating
> with the maintainer of the conflicting tree to minimise any particularly
> complex conflicts.
> 
> 
> diff --cc arch/riscv/include/uapi/asm/kvm.h
> index 855c047e86d4,61d7fecc4899..000000000000
> --- a/arch/riscv/include/uapi/asm/kvm.h
> +++ b/arch/riscv/include/uapi/asm/kvm.h
> @@@ -204,13 -204,77 +205,84 @@@ enum KVM_RISCV_SBI_EXT_ID 
>   #define KVM_REG_RISCV_SBI_MULTI_REG_LAST	\
>   		KVM_REG_RISCV_SBI_MULTI_REG(KVM_RISCV_SBI_EXT_MAX - 1)
>   
>  +/* V extension registers are mapped as type 9 */
>  +#define KVM_REG_RISCV_VECTOR		(0x09 << KVM_REG_RISCV_TYPE_SHIFT)
>  +#define KVM_REG_RISCV_VECTOR_CSR_REG(name)	\
>  +		(offsetof(struct __riscv_v_ext_state, name) / sizeof(unsigned long))
>  +#define KVM_REG_RISCV_VECTOR_REG(n)	\
>  +		((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long))
>  +
> + /* Device Control API: RISC-V AIA */
> + #define KVM_DEV_RISCV_APLIC_ALIGN		0x1000
> + #define KVM_DEV_RISCV_APLIC_SIZE		0x4000
> + #define KVM_DEV_RISCV_APLIC_MAX_HARTS		0x4000
> + #define KVM_DEV_RISCV_IMSIC_ALIGN		0x1000
> + #define KVM_DEV_RISCV_IMSIC_SIZE		0x1000
> + 
> + #define KVM_DEV_RISCV_AIA_GRP_CONFIG		0
> + #define KVM_DEV_RISCV_AIA_CONFIG_MODE		0
> + #define KVM_DEV_RISCV_AIA_CONFIG_IDS		1
> + #define KVM_DEV_RISCV_AIA_CONFIG_SRCS		2
> + #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_BITS	3
> + #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_SHIFT	4
> + #define KVM_DEV_RISCV_AIA_CONFIG_HART_BITS	5
> + #define KVM_DEV_RISCV_AIA_CONFIG_GUEST_BITS	6
> + 
> + /*
> +  * Modes of RISC-V AIA device:
> +  * 1) EMUL (aka Emulation): Trap-n-emulate IMSIC
> +  * 2) HWACCEL (aka HW Acceleration): Virtualize IMSIC using IMSIC guest files
> +  * 3) AUTO (aka Automatic): Virtualize IMSIC using IMSIC guest files whenever
> +  *    available otherwise fallback to trap-n-emulation
> +  */
> + #define KVM_DEV_RISCV_AIA_MODE_EMUL		0
> + #define KVM_DEV_RISCV_AIA_MODE_HWACCEL		1
> + #define KVM_DEV_RISCV_AIA_MODE_AUTO		2
> + 
> + #define KVM_DEV_RISCV_AIA_IDS_MIN		63
> + #define KVM_DEV_RISCV_AIA_IDS_MAX		2048
> + #define KVM_DEV_RISCV_AIA_SRCS_MAX		1024
> + #define KVM_DEV_RISCV_AIA_GROUP_BITS_MAX	8
> + #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MIN	24
> + #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MAX	56
> + #define KVM_DEV_RISCV_AIA_HART_BITS_MAX		16
> + #define KVM_DEV_RISCV_AIA_GUEST_BITS_MAX	8
> + 
> + #define KVM_DEV_RISCV_AIA_GRP_ADDR		1
> + #define KVM_DEV_RISCV_AIA_ADDR_APLIC		0
> + #define KVM_DEV_RISCV_AIA_ADDR_IMSIC(__vcpu)	(1 + (__vcpu))
> + #define KVM_DEV_RISCV_AIA_ADDR_MAX		\
> + 		(1 + KVM_DEV_RISCV_APLIC_MAX_HARTS)
> + 
> + #define KVM_DEV_RISCV_AIA_GRP_CTRL		2
> + #define KVM_DEV_RISCV_AIA_CTRL_INIT		0
> + 
> + /*
> +  * The device attribute type contains the memory mapped offset of the
> +  * APLIC register (range 0x0000-0x3FFF) and it must be 4-byte aligned.
> +  */
> + #define KVM_DEV_RISCV_AIA_GRP_APLIC		3
> + 
> + /*
> +  * The lower 12-bits of the device attribute type contains the iselect
> +  * value of the IMSIC register (range 0x70-0xFF) whereas the higher order
> +  * bits contains the VCPU id.
> +  */
> + #define KVM_DEV_RISCV_AIA_GRP_IMSIC		4
> + #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS	12
> + #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK	\
> + 		((1U << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) - 1)
> + #define KVM_DEV_RISCV_AIA_IMSIC_MKATTR(__vcpu, __isel)	\
> + 		(((__vcpu) << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) | \
> + 		 ((__isel) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK))
> + #define KVM_DEV_RISCV_AIA_IMSIC_GET_ISEL(__attr)	\
> + 		((__attr) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK)
> + #define KVM_DEV_RISCV_AIA_IMSIC_GET_VCPU(__attr)	\
> + 		((__attr) >> KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS)
> + 
> + /* One single KVM irqchip, ie. the AIA */
> + #define KVM_NR_IRQCHIPS			1
> + 
>   #endif
>   
>   #endif /* __LINUX_KVM_RISCV_H */

This is now a conflict between the kvm tree and Linus' tree.

-- 
Cheers,
Stephen Rothwell

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* linux-next: manual merge of the kvm-riscv tree with the risc-v tree
@ 2023-06-20  2:45 Stephen Rothwell
  2023-07-03  0:55 ` Stephen Rothwell
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2023-06-20  2:45 UTC (permalink / raw)
  To: Anup Patel, Palmer Dabbelt, Paul Walmsley
  Cc: Andy Chiu, Anup Patel, Greentime Hu, Linux Kernel Mailing List,
	Linux Next Mailing List, Vincent Chen

[-- Attachment #1: Type: text/plain, Size: 4581 bytes --]

Hi all,

Today's linux-next merge of the kvm-riscv tree got a conflict in:

  arch/riscv/include/uapi/asm/kvm.h

between commit:

  bf78f1ea6e51 ("riscv: kvm: Add V extension to KVM ISA")

from the risc-v tree and commit:

  3177011788ee ("RISC-V: KVM: Allow Svnapot extension for Guest/VM")

from the kvm-riscv tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/riscv/include/uapi/asm/kvm.h
index 855c047e86d4,a1ca18408bbd..000000000000
--- a/arch/riscv/include/uapi/asm/kvm.h
+++ b/arch/riscv/include/uapi/asm/kvm.h
@@@ -121,7 -122,7 +122,8 @@@ enum KVM_RISCV_ISA_EXT_ID 
  	KVM_RISCV_ISA_EXT_ZICBOZ,
  	KVM_RISCV_ISA_EXT_ZBB,
  	KVM_RISCV_ISA_EXT_SSAIA,
 +	KVM_RISCV_ISA_EXT_V,
+ 	KVM_RISCV_ISA_EXT_SVNAPOT,
  	KVM_RISCV_ISA_EXT_MAX,
  };
  
@@@ -204,13 -205,77 +206,84 @@@ enum KVM_RISCV_SBI_EXT_ID 
  #define KVM_REG_RISCV_SBI_MULTI_REG_LAST	\
  		KVM_REG_RISCV_SBI_MULTI_REG(KVM_RISCV_SBI_EXT_MAX - 1)
  
 +/* V extension registers are mapped as type 9 */
 +#define KVM_REG_RISCV_VECTOR		(0x09 << KVM_REG_RISCV_TYPE_SHIFT)
 +#define KVM_REG_RISCV_VECTOR_CSR_REG(name)	\
 +		(offsetof(struct __riscv_v_ext_state, name) / sizeof(unsigned long))
 +#define KVM_REG_RISCV_VECTOR_REG(n)	\
 +		((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long))
 +
+ /* Device Control API: RISC-V AIA */
+ #define KVM_DEV_RISCV_APLIC_ALIGN		0x1000
+ #define KVM_DEV_RISCV_APLIC_SIZE		0x4000
+ #define KVM_DEV_RISCV_APLIC_MAX_HARTS		0x4000
+ #define KVM_DEV_RISCV_IMSIC_ALIGN		0x1000
+ #define KVM_DEV_RISCV_IMSIC_SIZE		0x1000
+ 
+ #define KVM_DEV_RISCV_AIA_GRP_CONFIG		0
+ #define KVM_DEV_RISCV_AIA_CONFIG_MODE		0
+ #define KVM_DEV_RISCV_AIA_CONFIG_IDS		1
+ #define KVM_DEV_RISCV_AIA_CONFIG_SRCS		2
+ #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_BITS	3
+ #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_SHIFT	4
+ #define KVM_DEV_RISCV_AIA_CONFIG_HART_BITS	5
+ #define KVM_DEV_RISCV_AIA_CONFIG_GUEST_BITS	6
+ 
+ /*
+  * Modes of RISC-V AIA device:
+  * 1) EMUL (aka Emulation): Trap-n-emulate IMSIC
+  * 2) HWACCEL (aka HW Acceleration): Virtualize IMSIC using IMSIC guest files
+  * 3) AUTO (aka Automatic): Virtualize IMSIC using IMSIC guest files whenever
+  *    available otherwise fallback to trap-n-emulation
+  */
+ #define KVM_DEV_RISCV_AIA_MODE_EMUL		0
+ #define KVM_DEV_RISCV_AIA_MODE_HWACCEL		1
+ #define KVM_DEV_RISCV_AIA_MODE_AUTO		2
+ 
+ #define KVM_DEV_RISCV_AIA_IDS_MIN		63
+ #define KVM_DEV_RISCV_AIA_IDS_MAX		2048
+ #define KVM_DEV_RISCV_AIA_SRCS_MAX		1024
+ #define KVM_DEV_RISCV_AIA_GROUP_BITS_MAX	8
+ #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MIN	24
+ #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MAX	56
+ #define KVM_DEV_RISCV_AIA_HART_BITS_MAX		16
+ #define KVM_DEV_RISCV_AIA_GUEST_BITS_MAX	8
+ 
+ #define KVM_DEV_RISCV_AIA_GRP_ADDR		1
+ #define KVM_DEV_RISCV_AIA_ADDR_APLIC		0
+ #define KVM_DEV_RISCV_AIA_ADDR_IMSIC(__vcpu)	(1 + (__vcpu))
+ #define KVM_DEV_RISCV_AIA_ADDR_MAX		\
+ 		(1 + KVM_DEV_RISCV_APLIC_MAX_HARTS)
+ 
+ #define KVM_DEV_RISCV_AIA_GRP_CTRL		2
+ #define KVM_DEV_RISCV_AIA_CTRL_INIT		0
+ 
+ /*
+  * The device attribute type contains the memory mapped offset of the
+  * APLIC register (range 0x0000-0x3FFF) and it must be 4-byte aligned.
+  */
+ #define KVM_DEV_RISCV_AIA_GRP_APLIC		3
+ 
+ /*
+  * The lower 12-bits of the device attribute type contains the iselect
+  * value of the IMSIC register (range 0x70-0xFF) whereas the higher order
+  * bits contains the VCPU id.
+  */
+ #define KVM_DEV_RISCV_AIA_GRP_IMSIC		4
+ #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS	12
+ #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK	\
+ 		((1U << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) - 1)
+ #define KVM_DEV_RISCV_AIA_IMSIC_MKATTR(__vcpu, __isel)	\
+ 		(((__vcpu) << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) | \
+ 		 ((__isel) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK))
+ #define KVM_DEV_RISCV_AIA_IMSIC_GET_ISEL(__attr)	\
+ 		((__attr) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK)
+ #define KVM_DEV_RISCV_AIA_IMSIC_GET_VCPU(__attr)	\
+ 		((__attr) >> KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS)
+ 
+ /* One single KVM irqchip, ie. the AIA */
+ #define KVM_NR_IRQCHIPS			1
+ 
  #endif
  
  #endif /* __LINUX_KVM_RISCV_H */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* linux-next: manual merge of the kvm-riscv tree with the risc-v tree
@ 2023-06-19  2:33 Stephen Rothwell
  2023-07-03  0:54 ` Stephen Rothwell
  0 siblings, 1 reply; 7+ messages in thread
From: Stephen Rothwell @ 2023-06-19  2:33 UTC (permalink / raw)
  To: Anup Patel, Palmer Dabbelt, Paul Walmsley
  Cc: Andy Chiu, Anup Patel, Greentime Hu, Linux Kernel Mailing List,
	Linux Next Mailing List, Palmer Dabbelt, Vincent Chen

[-- Attachment #1: Type: text/plain, Size: 4604 bytes --]

Hi all,

Today's linux-next merge of the kvm-riscv tree got a conflict in:

  arch/riscv/include/uapi/asm/kvm.h

between commit:

  0f4b82579716 ("riscv: KVM: Add vector lazy save/restore support")

from the risc-v tree and commits:

  00f918f61c56 ("RISC-V: KVM: Skeletal in-kernel AIA irqchip support")
  89d01306e34d ("RISC-V: KVM: Implement device interface for AIA irqchip")
  289a007b98b0 ("RISC-V: KVM: Expose APLIC registers as attributes of AIA irqchip")
  4fe9eadad83b ("RISC-V: KVM: Expose IMSIC registers as attributes of AIA irqchip")

from the kvm-riscv tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc arch/riscv/include/uapi/asm/kvm.h
index 855c047e86d4,61d7fecc4899..000000000000
--- a/arch/riscv/include/uapi/asm/kvm.h
+++ b/arch/riscv/include/uapi/asm/kvm.h
@@@ -204,13 -204,77 +205,84 @@@ enum KVM_RISCV_SBI_EXT_ID 
  #define KVM_REG_RISCV_SBI_MULTI_REG_LAST	\
  		KVM_REG_RISCV_SBI_MULTI_REG(KVM_RISCV_SBI_EXT_MAX - 1)
  
 +/* V extension registers are mapped as type 9 */
 +#define KVM_REG_RISCV_VECTOR		(0x09 << KVM_REG_RISCV_TYPE_SHIFT)
 +#define KVM_REG_RISCV_VECTOR_CSR_REG(name)	\
 +		(offsetof(struct __riscv_v_ext_state, name) / sizeof(unsigned long))
 +#define KVM_REG_RISCV_VECTOR_REG(n)	\
 +		((n) + sizeof(struct __riscv_v_ext_state) / sizeof(unsigned long))
 +
+ /* Device Control API: RISC-V AIA */
+ #define KVM_DEV_RISCV_APLIC_ALIGN		0x1000
+ #define KVM_DEV_RISCV_APLIC_SIZE		0x4000
+ #define KVM_DEV_RISCV_APLIC_MAX_HARTS		0x4000
+ #define KVM_DEV_RISCV_IMSIC_ALIGN		0x1000
+ #define KVM_DEV_RISCV_IMSIC_SIZE		0x1000
+ 
+ #define KVM_DEV_RISCV_AIA_GRP_CONFIG		0
+ #define KVM_DEV_RISCV_AIA_CONFIG_MODE		0
+ #define KVM_DEV_RISCV_AIA_CONFIG_IDS		1
+ #define KVM_DEV_RISCV_AIA_CONFIG_SRCS		2
+ #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_BITS	3
+ #define KVM_DEV_RISCV_AIA_CONFIG_GROUP_SHIFT	4
+ #define KVM_DEV_RISCV_AIA_CONFIG_HART_BITS	5
+ #define KVM_DEV_RISCV_AIA_CONFIG_GUEST_BITS	6
+ 
+ /*
+  * Modes of RISC-V AIA device:
+  * 1) EMUL (aka Emulation): Trap-n-emulate IMSIC
+  * 2) HWACCEL (aka HW Acceleration): Virtualize IMSIC using IMSIC guest files
+  * 3) AUTO (aka Automatic): Virtualize IMSIC using IMSIC guest files whenever
+  *    available otherwise fallback to trap-n-emulation
+  */
+ #define KVM_DEV_RISCV_AIA_MODE_EMUL		0
+ #define KVM_DEV_RISCV_AIA_MODE_HWACCEL		1
+ #define KVM_DEV_RISCV_AIA_MODE_AUTO		2
+ 
+ #define KVM_DEV_RISCV_AIA_IDS_MIN		63
+ #define KVM_DEV_RISCV_AIA_IDS_MAX		2048
+ #define KVM_DEV_RISCV_AIA_SRCS_MAX		1024
+ #define KVM_DEV_RISCV_AIA_GROUP_BITS_MAX	8
+ #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MIN	24
+ #define KVM_DEV_RISCV_AIA_GROUP_SHIFT_MAX	56
+ #define KVM_DEV_RISCV_AIA_HART_BITS_MAX		16
+ #define KVM_DEV_RISCV_AIA_GUEST_BITS_MAX	8
+ 
+ #define KVM_DEV_RISCV_AIA_GRP_ADDR		1
+ #define KVM_DEV_RISCV_AIA_ADDR_APLIC		0
+ #define KVM_DEV_RISCV_AIA_ADDR_IMSIC(__vcpu)	(1 + (__vcpu))
+ #define KVM_DEV_RISCV_AIA_ADDR_MAX		\
+ 		(1 + KVM_DEV_RISCV_APLIC_MAX_HARTS)
+ 
+ #define KVM_DEV_RISCV_AIA_GRP_CTRL		2
+ #define KVM_DEV_RISCV_AIA_CTRL_INIT		0
+ 
+ /*
+  * The device attribute type contains the memory mapped offset of the
+  * APLIC register (range 0x0000-0x3FFF) and it must be 4-byte aligned.
+  */
+ #define KVM_DEV_RISCV_AIA_GRP_APLIC		3
+ 
+ /*
+  * The lower 12-bits of the device attribute type contains the iselect
+  * value of the IMSIC register (range 0x70-0xFF) whereas the higher order
+  * bits contains the VCPU id.
+  */
+ #define KVM_DEV_RISCV_AIA_GRP_IMSIC		4
+ #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS	12
+ #define KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK	\
+ 		((1U << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) - 1)
+ #define KVM_DEV_RISCV_AIA_IMSIC_MKATTR(__vcpu, __isel)	\
+ 		(((__vcpu) << KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS) | \
+ 		 ((__isel) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK))
+ #define KVM_DEV_RISCV_AIA_IMSIC_GET_ISEL(__attr)	\
+ 		((__attr) & KVM_DEV_RISCV_AIA_IMSIC_ISEL_MASK)
+ #define KVM_DEV_RISCV_AIA_IMSIC_GET_VCPU(__attr)	\
+ 		((__attr) >> KVM_DEV_RISCV_AIA_IMSIC_ISEL_BITS)
+ 
+ /* One single KVM irqchip, ie. the AIA */
+ #define KVM_NR_IRQCHIPS			1
+ 
  #endif
  
  #endif /* __LINUX_KVM_RISCV_H */

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-11-05 22:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-30  1:53 linux-next: manual merge of the kvm-riscv tree with the risc-v tree Stephen Rothwell
2023-11-01  2:37 ` Stephen Rothwell
2023-11-05 22:31   ` Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2023-06-20  2:45 Stephen Rothwell
2023-07-03  0:55 ` Stephen Rothwell
2023-06-19  2:33 Stephen Rothwell
2023-07-03  0:54 ` Stephen Rothwell

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).