From 722bc5b5d901eafb96e8530cc7cf3036bff398a4 Mon Sep 17 00:00:00 2001
From: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Date: Thu, 6 Aug 2020 12:42:55 +0300
Subject: xen: pvblock: Add initial support for para-virtualized block driver

Add initial infrastructure for Xen para-virtualized block device.
This includes compile-time configuration and the skeleton for
the future driver implementation.
Add new class UCLASS_PVBLOCK which is going to be a parent for
virtual block devices.
Add new interface type IF_TYPE_PVBLOCK.

Implement basic driver setup by reading XenStore configuration.

Signed-off-by: Andrii Anisov <andrii_anisov@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
---
 include/blk.h                    |  1 +
 include/configs/xenguest_arm64.h |  8 ++++++++
 include/dm/uclass-id.h           |  1 +
 include/pvblock.h                | 17 +++++++++++++++++
 4 files changed, 27 insertions(+)
 create mode 100644 include/pvblock.h

(limited to 'include')

diff --git a/include/blk.h b/include/blk.h
index abcd4bedbb..9ee10fb80e 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -33,6 +33,7 @@ enum if_type {
 	IF_TYPE_HOST,
 	IF_TYPE_NVME,
 	IF_TYPE_EFI,
+	IF_TYPE_PVBLOCK,
 	IF_TYPE_VIRTIO,
 
 	IF_TYPE_COUNT,			/* Number of interface types */
diff --git a/include/configs/xenguest_arm64.h b/include/configs/xenguest_arm64.h
index d8958cfe75..db3059a82c 100644
--- a/include/configs/xenguest_arm64.h
+++ b/include/configs/xenguest_arm64.h
@@ -41,4 +41,12 @@
 #define CONFIG_CMDLINE_TAG            1
 #define CONFIG_INITRD_TAG             1
 
+#define CONFIG_CMD_RUN
+
+#undef CONFIG_EXTRA_ENV_SETTINGS
+#define CONFIG_EXTRA_ENV_SETTINGS	\
+	"loadimage=ext4load pvblock 0 0x90000000 /boot/Image;\0" \
+	"pvblockboot=run loadimage;" \
+		"booti 0x90000000 - 0x88000000;\0"
+
 #endif /* __XENGUEST_ARM64_H */
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index dbc14ec342..4ec5fa6670 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -123,6 +123,7 @@ enum uclass_id {
 	UCLASS_W1,		/* Dallas 1-Wire bus */
 	UCLASS_W1_EEPROM,	/* one-wire EEPROMs */
 	UCLASS_WDT,		/* Watchdog Timer driver */
+	UCLASS_PVBLOCK,		/* Xen virtual block device */
 
 	UCLASS_COUNT,
 	UCLASS_INVALID = -1,
diff --git a/include/pvblock.h b/include/pvblock.h
new file mode 100644
index 0000000000..1023a6ab3b
--- /dev/null
+++ b/include/pvblock.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0+
+ *
+ * (C) 2020 EPAM Systems Inc.
+ */
+
+#ifndef _PVBLOCK_H
+#define _PVBLOCK_H
+
+/**
+ * pvblock_init() - Initialize para-virtual block device class driver
+ *
+ * Bind PV block to UCLASS_ROOT device and probe all UCLASS_PVBLOCK
+ * virtual block devices.
+ */
+void pvblock_init(void);
+
+#endif /* _PVBLOCK_H */
-- 
cgit