All of lore.kernel.org
 help / color / mirror / Atom feed
From: xiaoming <2014500726@smail.xtu.edu.cn>
To: Gabriel Somlo <somlo@cmu.edu>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	xiaoming <2014500726@smail.xtu.edu.cn>
Subject: [PATCH] [PATCH] drivers/firmware/qemu_fw_cfg: add RISCV support
Date: Wed,  1 Sep 2021 18:41:30 +0800	[thread overview]
Message-ID: <20210901104130.10185-1-2014500726@smail.xtu.edu.cn> (raw)

In the latest release of qemu (qemu 6.0.0 or higher) riscv virt already supports fw_cfg, but
drivers/firmware/qemu_fw_cfg not support.

Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
---
 drivers/firmware/Kconfig       | 2 +-
 drivers/firmware/qemu_fw_cfg.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 1db738d5b..4eb8d8a3a 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -186,7 +186,7 @@ config RASPBERRYPI_FIRMWARE
 
 config FW_CFG_SYSFS
 	tristate "QEMU fw_cfg device support in sysfs"
-	depends on SYSFS && (ARM || ARM64 || PARISC || PPC_PMAC || SPARC || X86)
+	depends on SYSFS && (ARM || ARM64 || PARISC || PPC_PMAC || SPARC || X86 || RISCV)
 	depends on HAS_IOPORT_MAP
 	default n
 	help
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index 172c751a4..36b5b2612 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -225,6 +225,10 @@ static void fw_cfg_io_cleanup(void)
 #  define FW_CFG_CTRL_OFF 0x00
 #  define FW_CFG_DATA_OFF 0x01
 #  define FW_CFG_DMA_OFF 0x04
+# elif defined(CONFIG_RISCV)
+#  define FW_CFG_CTRL_OFF 0x08
+#  define FW_CFG_DATA_OFF 0x00
+#  define FW_CFG_DMA_OFF 0x10
 # else
 #  error "QEMU FW_CFG not available on this architecture!"
 # endif
-- 
2.17.1




WARNING: multiple messages have this Message-ID (diff)
From: xiaoming <2014500726@smail.xtu.edu.cn>
To: Gabriel Somlo <somlo@cmu.edu>
Cc: linux-kernel@vger.kernel.org,
	xiaoming <2014500726@smail.xtu.edu.cn>,
	qemu-devel@nongnu.org, "Michael S . Tsirkin" <mst@redhat.com>
Subject: [PATCH] [PATCH] drivers/firmware/qemu_fw_cfg: add RISCV support
Date: Wed,  1 Sep 2021 18:41:30 +0800	[thread overview]
Message-ID: <20210901104130.10185-1-2014500726@smail.xtu.edu.cn> (raw)

In the latest release of qemu (qemu 6.0.0 or higher) riscv virt already supports fw_cfg, but
drivers/firmware/qemu_fw_cfg not support.

Signed-off-by: xiaoming <2014500726@smail.xtu.edu.cn>
---
 drivers/firmware/Kconfig       | 2 +-
 drivers/firmware/qemu_fw_cfg.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 1db738d5b..4eb8d8a3a 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -186,7 +186,7 @@ config RASPBERRYPI_FIRMWARE
 
 config FW_CFG_SYSFS
 	tristate "QEMU fw_cfg device support in sysfs"
-	depends on SYSFS && (ARM || ARM64 || PARISC || PPC_PMAC || SPARC || X86)
+	depends on SYSFS && (ARM || ARM64 || PARISC || PPC_PMAC || SPARC || X86 || RISCV)
 	depends on HAS_IOPORT_MAP
 	default n
 	help
diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c
index 172c751a4..36b5b2612 100644
--- a/drivers/firmware/qemu_fw_cfg.c
+++ b/drivers/firmware/qemu_fw_cfg.c
@@ -225,6 +225,10 @@ static void fw_cfg_io_cleanup(void)
 #  define FW_CFG_CTRL_OFF 0x00
 #  define FW_CFG_DATA_OFF 0x01
 #  define FW_CFG_DMA_OFF 0x04
+# elif defined(CONFIG_RISCV)
+#  define FW_CFG_CTRL_OFF 0x08
+#  define FW_CFG_DATA_OFF 0x00
+#  define FW_CFG_DMA_OFF 0x10
 # else
 #  error "QEMU FW_CFG not available on this architecture!"
 # endif
-- 
2.17.1





             reply	other threads:[~2021-09-01 10:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 10:41 xiaoming [this message]
2021-09-01 10:41 ` [PATCH] [PATCH] drivers/firmware/qemu_fw_cfg: add RISCV support xiaoming

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-all 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=20210901104130.10185-1-2014500726@smail.xtu.edu.cn \
    --to=2014500726@smail.xtu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=somlo@cmu.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.