Re: vmm(4) allow IO ports for fw_cfg interface

2018-12-10 Thread Mike Larkin
On Mon, Dec 10, 2018 at 05:29:39PM +0100, Claudio Jeker wrote:
> qemu has the fw_cfg mechanism to pass data from the emulator to the bios.
> SeaBIOS also includes fw_cfg support and so it makes sense to add this to
> vmd(4) as well. To make this happen the following IO ports need to be
> forwarded by vmm(4) to vmd(8).
>   FW_CFG_IO_SELECT0x510
>   FW_CFG_IO_DATA  0x511
>   FW_CFG_IO_DMA_ADDR_HIGH 0x514
>   FW_CFG_IO_DMA_ADDR_LOW  0x518
> 
> It is possible to not use the DMA interface but I think it may be better
> to have it.
> -- 
> :wq Claudio
> 
> Index: arch/amd64/amd64//vmm.c
> ===
> RCS file: /cvs/src/sys/arch/amd64/amd64/vmm.c,v
> retrieving revision 1.221
> diff -u -p -r1.221 vmm.c
> --- arch/amd64/amd64//vmm.c   7 Oct 2018 22:43:06 -   1.221
> +++ arch/amd64/amd64//vmm.c   10 Dec 2018 14:46:52 -
> @@ -5128,7 +5128,9 @@ svm_handle_inout(struct vcpu *vcpu)
>   case IO_ICU2 ... IO_ICU2 + 1:
>   case 0x3f8 ... 0x3ff:
>   case ELCR0 ... ELCR1:
> - case 0x500 ... 0x50f:
> + case 0x500 ... 0x511:
> + case 0x514:
> + case 0x518:
>   case 0xcf8:
>   case 0xcfc ... 0xcff:
>   case VMM_PCI_IO_BAR_BASE ... VMM_PCI_IO_BAR_END:
> @@ -5221,9 +5223,11 @@ vmx_handle_inout(struct vcpu *vcpu)
>   case IO_ICU2 ... IO_ICU2 + 1:
>   case 0x3f8 ... 0x3ff:
>   case ELCR0 ... ELCR1:
> + case 0x500 ... 0x511:
> + case 0x514:
> + case 0x518:
>   case 0xcf8:
>   case 0xcfc ... 0xcff:
> - case 0x500 ... 0x50f:
>   case VMM_PCI_IO_BAR_BASE ... VMM_PCI_IO_BAR_END:
>   ret = EAGAIN;
>   break;
> 

ok mlarkin



vmm(4) allow IO ports for fw_cfg interface

2018-12-10 Thread Claudio Jeker
qemu has the fw_cfg mechanism to pass data from the emulator to the bios.
SeaBIOS also includes fw_cfg support and so it makes sense to add this to
vmd(4) as well. To make this happen the following IO ports need to be
forwarded by vmm(4) to vmd(8).
FW_CFG_IO_SELECT0x510
FW_CFG_IO_DATA  0x511
FW_CFG_IO_DMA_ADDR_HIGH 0x514
FW_CFG_IO_DMA_ADDR_LOW  0x518

It is possible to not use the DMA interface but I think it may be better
to have it.
-- 
:wq Claudio

Index: arch/amd64/amd64//vmm.c
===
RCS file: /cvs/src/sys/arch/amd64/amd64/vmm.c,v
retrieving revision 1.221
diff -u -p -r1.221 vmm.c
--- arch/amd64/amd64//vmm.c 7 Oct 2018 22:43:06 -   1.221
+++ arch/amd64/amd64//vmm.c 10 Dec 2018 14:46:52 -
@@ -5128,7 +5128,9 @@ svm_handle_inout(struct vcpu *vcpu)
case IO_ICU2 ... IO_ICU2 + 1:
case 0x3f8 ... 0x3ff:
case ELCR0 ... ELCR1:
-   case 0x500 ... 0x50f:
+   case 0x500 ... 0x511:
+   case 0x514:
+   case 0x518:
case 0xcf8:
case 0xcfc ... 0xcff:
case VMM_PCI_IO_BAR_BASE ... VMM_PCI_IO_BAR_END:
@@ -5221,9 +5223,11 @@ vmx_handle_inout(struct vcpu *vcpu)
case IO_ICU2 ... IO_ICU2 + 1:
case 0x3f8 ... 0x3ff:
case ELCR0 ... ELCR1:
+   case 0x500 ... 0x511:
+   case 0x514:
+   case 0x518:
case 0xcf8:
case 0xcfc ... 0xcff:
-   case 0x500 ... 0x50f:
case VMM_PCI_IO_BAR_BASE ... VMM_PCI_IO_BAR_END:
ret = EAGAIN;
break;