public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org,
	virtualization@lists.linux-foundation.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Anthony Liguori" <aliguori@amazon.com>,
	"Anton Vorontsov" <anton@enomsg.org>,
	"Colin Cross" <ccross@android.com>,
	"Kees Cook" <keescook@chromium.org>,
	"Tony Luck" <tony.luck@intel.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Minchan Kim" <minchan@kernel.org>
Subject: [PATCH 5/7] virtio-pstore: Support PSTORE_TYPE_CONSOLE
Date: Thu, 28 Jul 2016 00:08:29 +0900	[thread overview]
Message-ID: <1469632111-23260-6-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1469632111-23260-1-git-send-email-namhyung@kernel.org>

With help of buffer management functions, it now supports CONSOLE type
pstore write.  The config space has flags field which defines the
VIRTIO_PSTORE_CONFIG_FL_CONSOLE.  When it's set, the virtio-pstore
driver also sets PSTORE_FLAGS_ASYNC so that the buffer management is
enabled.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 drivers/virtio/virtio_pstore.c     | 9 ++++++++-
 include/uapi/linux/virtio_pstore.h | 4 ++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_pstore.c b/drivers/virtio/virtio_pstore.c
index 4ee1c186f582..458c4d3ccbb1 100644
--- a/drivers/virtio/virtio_pstore.c
+++ b/drivers/virtio/virtio_pstore.c
@@ -33,6 +33,7 @@ struct type_table {
 	u16 virtio;
 } type_table[] = {
 	TYPE_TABLE_ENTRY(DMESG),
+	TYPE_TABLE_ENTRY(CONSOLE),
 };
 
 #undef TYPE_TABLE_ENTRY
@@ -276,7 +277,8 @@ static int virt_pstore_init(struct virtio_pstore *vps)
 	psinfo->read  = virt_pstore_read;
 	psinfo->erase = virt_pstore_erase;
 	psinfo->write = virt_pstore_write;
-	psinfo->flags = PSTORE_FLAGS_DMESG;
+	/* preserve flags from config */
+	psinfo->flags |= PSTORE_FLAGS_DMESG;
 
 	psinfo->data  = vps;
 	spin_lock_init(&psinfo->buf_lock);
@@ -313,10 +315,15 @@ static int virtpstore_init_vqs(struct virtio_pstore *vps)
 static void virtpstore_init_config(struct virtio_pstore *vps)
 {
 	u32 bufsize;
+	u32 flags;
 
 	virtio_cread(vps->vdev, struct virtio_pstore_config, bufsize, &bufsize);
+	virtio_cread(vps->vdev, struct virtio_pstore_config, flags, &flags);
 
 	vps->pstore.bufsize = PAGE_ALIGN(bufsize);
+
+	if (flags & VIRTIO_PSTORE_CONFIG_FL_CONSOLE)
+		vps->pstore.flags |= PSTORE_FLAGS_CONSOLE | PSTORE_FLAGS_ASYNC;
 }
 
 static void virtpstore_confirm_config(struct virtio_pstore *vps)
diff --git a/include/uapi/linux/virtio_pstore.h b/include/uapi/linux/virtio_pstore.h
index f4b0d204d8ae..56d0b1554231 100644
--- a/include/uapi/linux/virtio_pstore.h
+++ b/include/uapi/linux/virtio_pstore.h
@@ -37,9 +37,12 @@
 
 #define VIRTIO_PSTORE_TYPE_UNKNOWN  0
 #define VIRTIO_PSTORE_TYPE_DMESG    1
+#define VIRTIO_PSTORE_TYPE_CONSOLE  2
 
 #define VIRTIO_PSTORE_FL_COMPRESSED  1
 
+#define VIRTIO_PSTORE_CONFIG_FL_CONSOLE  (1 << 0)
+
 struct virtio_pstore_req {
 	__virtio16		cmd;
 	__virtio16		type;
@@ -69,6 +72,7 @@ struct virtio_pstore_fileinfo {
 
 struct virtio_pstore_config {
 	__virtio32		bufsize;
+	__virtio32		flags;
 };
 
 #endif /* _LINUX_VIRTIO_PSTORE_H */
-- 
2.8.0

  parent reply	other threads:[~2016-07-27 15:08 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 15:08 [RFC/PATCHSET 0/7] virtio: Implement virtio pstore device (v2) Namhyung Kim
2016-07-27 15:08 ` [PATCH 1/7] pstore: Split pstore fragile flags Namhyung Kim
2016-07-27 15:08 ` [PATCH 2/7] pstore/ram: Set pstore flags dynamically Namhyung Kim
2016-07-27 15:08 ` [PATCH 3/7] pstore: Manage buffer position for async write Namhyung Kim
2016-07-27 15:08 ` [PATCH 4/7] virtio: Basic implementation of virtio pstore driver Namhyung Kim
2016-07-27 15:08 ` Namhyung Kim [this message]
2016-07-27 15:08 ` [PATCH 6/7] qemu: Implement virtio-pstore device Namhyung Kim
2016-07-28  0:02   ` Michael S. Tsirkin
2016-07-28  5:39     ` Namhyung Kim
2016-07-28 12:56       ` Stefan Hajnoczi
2016-07-28 13:08         ` [Qemu-devel] " Daniel P. Berrange
2016-07-30  8:38           ` Namhyung Kim
2016-08-01  9:21             ` Daniel P. Berrange
2016-08-01 15:34               ` Namhyung Kim
2016-07-28 14:38       ` Steven Rostedt
2016-07-28 13:22   ` [Qemu-devel] " Daniel P. Berrange
2016-07-30  8:57     ` Namhyung Kim
2016-08-01  9:24       ` Daniel P. Berrange
2016-08-01 15:52         ` Namhyung Kim
2016-07-27 15:08 ` [PATCH 7/7] kvmtool: " Namhyung Kim
2016-07-27 22:18 ` [RFC/PATCHSET 0/7] virtio: Implement virtio pstore device (v2) Michael S. Tsirkin
2016-07-28  2:46   ` Namhyung Kim

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=1469632111-23260-6-git-send-email-namhyung@kernel.org \
    --to=namhyung@kernel.org \
    --cc=aliguori@amazon.com \
    --cc=anton@enomsg.org \
    --cc=ccross@android.com \
    --cc=keescook@chromium.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkrcmar@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tony.luck@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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