From patchwork Wed Jul 27 15:08:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Namhyung Kim X-Patchwork-Id: 9249971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5B09560757 for ; Wed, 27 Jul 2016 15:11:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D186269B2 for ; Wed, 27 Jul 2016 15:11:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4182526D17; Wed, 27 Jul 2016 15:11:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D86E826B39 for ; Wed, 27 Jul 2016 15:11:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756863AbcG0PJ7 (ORCPT ); Wed, 27 Jul 2016 11:09:59 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:34083 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756848AbcG0PJ6 (ORCPT ); Wed, 27 Jul 2016 11:09:58 -0400 Received: by mail-pf0-f195.google.com with SMTP id g202so2007012pfb.1; Wed, 27 Jul 2016 08:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WZepAE2z41S5IVaOjnAc+VF97LU09fxL/1/McyWZswE=; b=ZvBBL9kfMSiIbxfcFJY+JQs6dcXI7d0K8l8WyS6JRB78C+5WASKrMVlG4hR3xMzSuT xbwiKcBCC4XAgJesew68UQTBX4I9QOOZnM5h5IwY+OUGSiWP47i5kPoZGpW2OKBBB3jM UMiIziRsFTDU6rGHhzuKeJA0XcSRJ2v8wPPsihn29fxafwa5z+QpVo717YQ7yW17+2ez gwrZO6bEYoGe91dFOmSZwdPSImre4VfXt4qvPPWUtBU57d0tsfTs7/uDy4JaMq+rZMr4 LvjJsMYv4NAJN95KhyHuCgeg4EPwdwK+/xtjivhMj+l/Yo0vd45M/UyntKd4iF1ZpGoR hlaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=WZepAE2z41S5IVaOjnAc+VF97LU09fxL/1/McyWZswE=; b=ZRCJjxFNS0swJGHTJ5pCJwwFmuuYSA966TKxmgbDBQsThtzIClmpCn7g3c1nfRdiuY dur3w+DOsEXUyjF7wuHTIY61tVllBbhsXC/AoulcL/wav4iQLfu9NmgFKwEH55jNCb4S 4jm0LrnSnc7fVh7NEMjZZDIPLNsnmDA2ZlRs3qCwR30p16lCn5j4OkDy99Cmyf/CWsTI ldTT/OGaRfBxiTRzr163rqZP7nvH+pcMhVc/EEGPOZVrqSAOyKhTnSMidYN912sYrpKc Nsos3Xz6EnjNXAVtGNvFKzQCqg98/bi1SlkSCMN0AIgSvt3e8UX/ErrqJHqAe7eCSZDU I/MQ== X-Gm-Message-State: AEkoousBtD4haICHwESHjunlxmCphLQaL9+yzDCTbmOJ+a8Tjj3tNJMA6tv324aabtBAXQ== X-Received: by 10.98.73.131 with SMTP id r3mr50244716pfi.112.1469632197262; Wed, 27 Jul 2016 08:09:57 -0700 (PDT) Received: from danjae.aot.lge.com ([210.100.147.61]) by smtp.gmail.com with ESMTPSA id 15sm10058488pfz.36.2016.07.27.08.09.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 27 Jul 2016 08:09:56 -0700 (PDT) From: Namhyung Kim To: kvm@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org Cc: LKML , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , "Michael S. Tsirkin" , Anthony Liguori , Anton Vorontsov , Colin Cross , Kees Cook , Tony Luck , Steven Rostedt , Ingo Molnar , Minchan Kim Subject: [PATCH 5/7] virtio-pstore: Support PSTORE_TYPE_CONSOLE Date: Thu, 28 Jul 2016 00:08:29 +0900 Message-Id: <1469632111-23260-6-git-send-email-namhyung@kernel.org> X-Mailer: git-send-email 2.8.0 In-Reply-To: <1469632111-23260-1-git-send-email-namhyung@kernel.org> References: <1469632111-23260-1-git-send-email-namhyung@kernel.org> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Radim Krčmář Cc: "Michael S. Tsirkin" Cc: Anthony Liguori Cc: Anton Vorontsov Cc: Colin Cross Cc: Kees Cook Cc: Tony Luck Cc: Steven Rostedt Cc: Ingo Molnar Cc: Minchan Kim Cc: kvm@vger.kernel.org Cc: qemu-devel@nongnu.org Cc: virtualization@lists.linux-foundation.org Signed-off-by: Namhyung Kim --- 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 */