From: "Sami Mujawar" <sami.mujawar@arm.com>
To: Chandni Cherukuri <Chandni.Cherukuri@arm.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
Leif Lindholm <leif@nuviainc.com>, nd <nd@arm.com>
Subject: Re: [edk2-platforms][PATCH V2 7/7] Platform/ARM/Morello: Add virtio net support
Date: Mon, 12 Apr 2021 09:22:41 +0000 [thread overview]
Message-ID: <D268BFB7-C189-40F2-8B51-701B82DD5285@arm.com> (raw)
In-Reply-To: <20210401143537.4799-8-chandni.cherukuri@arm.com>
Hi Chandni,
This patch looks good to me.
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Regards,
Sami Mujawar
On 01/04/2021, 15:36, "Chandni Cherukuri" <chandni.cherukuri@arm.com> wrote:
This patch registers a virtio net device for Morello
FVP platform.
Signed-off-by: Chandni Cherukuri <chandni.cherukuri@arm.com>
---
Platform/ARM/Morello/MorelloPlatform.dec | 6 ++
Platform/ARM/Morello/MorelloPlatformFvp.dsc | 7 +++
Platform/ARM/Morello/MorelloPlatformFvp.fdf | 6 ++
Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf | 2 +
Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h | 3 +
Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c | 58 ++++++++++++++++++++
6 files changed, 82 insertions(+)
diff --git a/Platform/ARM/Morello/MorelloPlatform.dec b/Platform/ARM/Morello/MorelloPlatform.dec
index 9a674593cb3c..6f5c1c1b59fc 100644
--- a/Platform/ARM/Morello/MorelloPlatform.dec
+++ b/Platform/ARM/Morello/MorelloPlatform.dec
@@ -55,6 +55,12 @@
gArmMorelloTokenSpaceGuid.PcdPciMmio64Translation|0x0|UINT64|0x00000017
gArmMorelloTokenSpaceGuid.PcdPciExpressBaseAddress|0x20000000|UINT64|0x00000018
+ # Virtio Net device
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetBaseAddress|0x00000000|UINT32|0x00000019
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetSize|0x00000000|UINT32|0x0000001A
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetInterrupt|0x00000000|UINT32|0x0000001B
+
[PcdsFeatureFlag.common]
gArmMorelloTokenSpaceGuid.PcdRamDiskSupported|FALSE|BOOLEAN|0x00000007
gArmMorelloTokenSpaceGuid.PcdVirtioBlkSupported|FALSE|BOOLEAN|0x00000008
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetSupported|FALSE|BOOLEAN|0x0000001C
diff --git a/Platform/ARM/Morello/MorelloPlatformFvp.dsc b/Platform/ARM/Morello/MorelloPlatformFvp.dsc
index 35e02be5d5ab..e579fb917348 100644
--- a/Platform/ARM/Morello/MorelloPlatformFvp.dsc
+++ b/Platform/ARM/Morello/MorelloPlatformFvp.dsc
@@ -47,6 +47,7 @@
[PcdsFeatureFlag.common]
gArmMorelloTokenSpaceGuid.PcdVirtioBlkSupported|TRUE
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetSupported|TRUE
[PcdsFixedAtBuild.common]
# Virtio Disk
@@ -54,8 +55,14 @@
gArmMorelloTokenSpaceGuid.PcdVirtioBlkSize|0x200
gArmMorelloTokenSpaceGuid.PcdVirtioBlkInterrupt|128
+ # Virtio Net
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetBaseAddress|0x1C180000
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetSize|0x200
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetInterrupt|134
+
[Components.common]
OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
+ OvmfPkg/VirtioNetDxe/VirtioNet.inf
# Platform driver
Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf
diff --git a/Platform/ARM/Morello/MorelloPlatformFvp.fdf b/Platform/ARM/Morello/MorelloPlatformFvp.fdf
index dc3eccd2f3ba..851ee3159b3d 100644
--- a/Platform/ARM/Morello/MorelloPlatformFvp.fdf
+++ b/Platform/ARM/Morello/MorelloPlatformFvp.fdf
@@ -120,6 +120,12 @@ READ_LOCK_STATUS = TRUE
# Virtio Block Device support
INF OvmfPkg/VirtioBlkDxe/VirtioBlk.inf
+ # Networking stack
+ !include NetworkPkg/Network.fdf.inc
+
+ # Virtio Net support
+ INF OvmfPkg/VirtioNetDxe/VirtioNet.inf
+
# FAT filesystem + GPT/MBR partitioning
INF FatPkg/EnhancedFatDxe/Fat.inf
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
diff --git a/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf
index e4882343fc77..c36c62f05a39 100644
--- a/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf
+++ b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf
@@ -34,11 +34,13 @@
[FeaturePcd]
gArmMorelloTokenSpaceGuid.PcdRamDiskSupported
gArmMorelloTokenSpaceGuid.PcdVirtioBlkSupported
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetSupported
[FixedPcd]
gArmMorelloTokenSpaceGuid.PcdRamDiskBase
gArmMorelloTokenSpaceGuid.PcdRamDiskSize
gArmMorelloTokenSpaceGuid.PcdVirtioBlkBaseAddress
+ gArmMorelloTokenSpaceGuid.PcdVirtioNetBaseAddress
[Depex]
gEfiRamDiskProtocolGuid
diff --git a/Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h b/Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h
index 77adffbfd984..b8bd40c104a2 100644
--- a/Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h
+++ b/Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h
@@ -11,4 +11,7 @@
#define MORELLO_VIRTIO_BLOCK_GUID \
{ 0x2B6E62D0, 0x9346, 0x4E1A, { 0xAA, 0x1E, 0xCB, 0x01, 0xC3, 0x23, 0x4A, 0x00 } }
+#define MORELLO_VIRTIO_NET_GUID \
+ { 0x4B428575, 0xD09B, 0x45EE, { 0xAC, 0x91, 0xB1, 0x36, 0xBE, 0xD6, 0x70, 0x2B } }
+
#endif //MORELLO_VIRTIO_DEVICES_FORMSET_H_
diff --git a/Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c b/Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c
index 7414e0666ce0..1566d3142fc3 100644
--- a/Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c
+++ b/Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c
@@ -40,6 +40,29 @@ STATIC VIRTIO_DEVICE_PATH mVirtioBlockDevicePath =
}
};
+STATIC VIRTIO_DEVICE_PATH mVirtioNetDevicePath =
+{
+ {
+ {
+ HARDWARE_DEVICE_PATH,
+ HW_VENDOR_DP,
+ {
+ (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
+ (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
+ }
+ },
+ MORELLO_VIRTIO_NET_GUID,
+ },
+ {
+ END_DEVICE_PATH_TYPE,
+ END_ENTIRE_DEVICE_PATH_SUBTYPE,
+ {
+ sizeof (EFI_DEVICE_PATH_PROTOCOL),
+ 0
+ }
+ }
+};
+
/**
Initialize platform Virtio devices.
@@ -51,8 +74,10 @@ InitVirtioDevices (
{
EFI_STATUS Status;
EFI_HANDLE mVirtIoBlkController;
+ EFI_HANDLE mVirtIoNetController;
mVirtIoBlkController = NULL;
+ mVirtIoNetController = NULL;
// Install protocol interface for storage device
if (FeaturePcdGet (PcdVirtioBlkSupported)) {
@@ -87,4 +112,37 @@ InitVirtioDevices (
}
}
}
+
+ // Install protocol interface for network device
+ if (FeaturePcdGet (PcdVirtioNetSupported)) {
+
+ Status = gBS->InstallProtocolInterface (
+ &mVirtIoNetController,
+ &gEfiDevicePathProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mVirtioNetDevicePath
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Failed to install EFI_DEVICE_PATH protocol "
+ "for Virtio Net (Status = %r)\n",
+ __FUNCTION__, Status));
+ } else {
+ // Declare the Virtio Net device
+ Status = VirtioMmioInstallDevice (
+ FixedPcdGet32 (PcdVirtioNetBaseAddress),
+ mVirtIoNetController
+ );
+ if (EFI_ERROR (Status)) {
+ DEBUG ((DEBUG_ERROR, "%a: Unable to find Virtio Block MMIO device "
+ "(Status == %r)\n", __FUNCTION__, Status));
+ gBS->UninstallProtocolInterface (
+ mVirtIoNetController,
+ &gEfiDevicePathProtocolGuid,
+ &mVirtioNetDevicePath
+ );
+ } else {
+ DEBUG ((DEBUG_INIT, "%a: Installed Virtio Net\n", __FUNCTION__));
+ }
+ }
+ }
}
--
2.17.1
prev parent reply other threads:[~2021-04-12 9:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-01 14:35 [edk2-platforms][PATCH V2 0/7] Add Morello FVP platform support chandni cherukuri
2021-04-01 14:35 ` [edk2-platforms][PATCH V2 1/7] Platform/ARM/Morello: Add Platform library implementation chandni cherukuri
2021-04-08 18:05 ` Sami Mujawar
2021-04-01 14:35 ` [edk2-platforms][PATCH V2 2/7] Platform/ARM/Morello: Add support for PciHostBridgeLib chandni cherukuri
2021-04-08 18:06 ` Sami Mujawar
2021-04-01 14:35 ` [edk2-platforms][PATCH V2 3/7] Platform/ARM/Morello: Add PlatformDxe driver for Morello chandni cherukuri
2021-04-08 18:06 ` Sami Mujawar
2021-04-01 14:35 ` [edk2-platforms][PATCH V2 4/7] Platform/ARM/Morello: Add Configuration Manager " chandni cherukuri
2021-04-12 9:18 ` Sami Mujawar
2021-04-01 14:35 ` [edk2-platforms][PATCH V2 5/7] Platform/ARM/Morello: Add initial support for Morello Platform chandni cherukuri
2021-04-12 9:18 ` Sami Mujawar
2021-04-01 14:35 ` [edk2-platforms][PATCH V2 6/7] Platform-ARM-Morello: Add Readme.md file chandni cherukuri
2021-04-12 9:19 ` Sami Mujawar
2021-04-01 14:35 ` [edk2-platforms][PATCH V2 7/7] Platform/ARM/Morello: Add virtio net support chandni cherukuri
2021-04-12 9:22 ` Sami Mujawar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=D268BFB7-C189-40F2-8B51-701B82DD5285@arm.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox