From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579803642; cv=none;
	d=zohomail.com; s=zohoarc;
	b=HSLtkU6pKNcVAGLygEL+KMqZfX/5POmz1Pyibf3od5S2LDaITt511h+Qkpk9ocwwocG/9jY2C8StfptweQfX7YAj3cVvO577OLQlx3clv5sBe8hw+id8KXgte33UyN9IKm9+OwE5LvLtOppudpYPAz6PZRry46tBsIKYqd6FEQ4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579803642;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=jiFm42luXRGQ/r26a989FdFKx0ijBFZqT4Y/4nl+p6I=;
	b=GoBN5Lb4cTcf3pinHcErsb2wkpNk0PAnWY5pdsJxBshJFWqwfGhJwDTlTl45n1CxNTtWRmU/vo05mH1LPhgg6w66NiGXeZWiqT2iY7BRucu+ODboKbcYbtmHn6uZDivAX75MFkmpOQCf/H6O0g61CuJ0VleUGsKthynUYSfxVJQ=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579803642462123.36056655009054;
 Thu, 23 Jan 2020 10:20:42 -0800 (PST)
Received: from localhost ([::1]:34576 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iuh5s-0001qk-Nv
	for importer@patchew.org; Thu, 23 Jan 2020 13:20:40 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48274)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRT-00005I-FQ
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRS-0003Z3-5M
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:47 -0500
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:33979)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRR-0003Y4-Vd
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:46 -0500
Received: by mail-wr1-x432.google.com with SMTP id t2so3585086wrr.1
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:45 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.43
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=jiFm42luXRGQ/r26a989FdFKx0ijBFZqT4Y/4nl+p6I=;
 b=jmflZrYo/7+2fkwM6KpMQ3Zmmg1u357NTHiaZleVFhk1UQ0SyfCL5rWUHSoy/MB1cb
 J8QKFS5zGhnuxaehPX2Xt9sTAuG9/ChoS7SNQvs2Y1nTIVw5NRLvQhZGXU9J1ywTkK5i
 Od3tejUo/PWbZjQ0KkOnox9ZJYtFG0fiQug+D1qpAob1/up4gg6Lm5Zmq5Cub9ssiA4/
 nZeH/f/4QVTgA9a1M5YlKjKL/H4H+rhBq9gjnwuo/PQHWbmvgbSF2iVC0hdW71B1UDLt
 jBaaY+3BMCdPH77ZT6pB5PsHU6MbCs9DpZL4JD+aZypp/54TuDWnZ7XtrOS9hRxcmPYP
 qyKg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=jiFm42luXRGQ/r26a989FdFKx0ijBFZqT4Y/4nl+p6I=;
 b=ZXzkx2kHDzwS2EIzd7yn2PoHXsF3xmLQYPoHrBSYsboKf9+VojOo2QEuV4LGnTlc8o
 1ZWWIhJUSlfnCDLHs5Hqc0+QNt4+3pAW7s1OiyYbKu2/YWXKLFChnEy/qQlZtQUzY2of
 IWxTONDFbZeXW6/ywul6xB2TS/JWygvh5FoTKCbcoqozgBx7zDJeXgiM34AqsEN708BO
 kPgXKbEtGoEK5hj+uJBBqc8zqlkTjlUNM3U1nR7ooyvlLNFvGgqdG19RVW0ZRdc3gJw5
 Xe+Auqbm1SrxXrw3dzRmMMpbuAyhTnTzPDyDCzM2VsLuj70dSOs5iY3cIO/ZnTvH4wUR
 i9SA==
X-Gm-Message-State: APjAAAWeDvOGVM3imencmKACP2Myn/G4SaVx7qiTu2nC/UpR+YD+DTmC
 9M7P7glGkj25e05WLPHMM1wRkx5b1YwzjA==
X-Google-Smtp-Source: 
 APXvYqwMr1zTAdm7mJG4LWx5bvG9EGpATodLmz53yTXha4NrY4vu33kH56FGHm9Q2GsK8C/7HsNbMw==
X-Received: by 2002:a5d:6b88:: with SMTP id n8mr18602037wrx.288.1579793444691;
 Thu, 23 Jan 2020 07:30:44 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 01/20] target/arm: add PMU feature to cortex-r5 and cortex-r5f
Date: Thu, 23 Jan 2020 15:30:22 +0000
Message-Id: <20200123153041.4248-2-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::432
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

From: Clement Deschamps <clement.deschamps@greensocs.com>

The PMU is not optional on cortex-r5 and cortex-r5f (see
the "Features" chapter of the Technical Reference Manual).

Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
Reviewed-by: Philippe Mathieu-Daud=C3=A9 <philmd@redhat.com>
Message-id: 20200114105918.2366370-1-clement.deschamps@greensocs.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index d62fd5fdc64..64cd0a7d73c 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2121,6 +2121,7 @@ static void cortex_r5_initfn(Object *obj)
     set_feature(&cpu->env, ARM_FEATURE_V7);
     set_feature(&cpu->env, ARM_FEATURE_V7MP);
     set_feature(&cpu->env, ARM_FEATURE_PMSA);
+    set_feature(&cpu->env, ARM_FEATURE_PMU);
     cpu->midr =3D 0x411fc153; /* r1p3 */
     cpu->id_pfr0 =3D 0x0131;
     cpu->id_pfr1 =3D 0x001;
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579801114; cv=none;
	d=zohomail.com; s=zohoarc;
	b=GN/kbt8LQBOXt07XTH288V52kEteG6K6Kpl75L3dtPsbVspBePrw9onLmGHRv9PtXTrX3DvKe5KpCvDaGxKYUSs82opx/d2gR33s83Li3GBFGTs4JXUJWrr3Z4PJCgqQ+UglbyFEZ2iKxbdyKJazMS0kygU1ofmBo4Z+8tDEqLI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579801114;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=eblYmalTC0fBvO9ZzHTdvSGAe+FYdbVrliGqrCf/xro=;
	b=IHxmJKROIHoFr8tXqdMkS62jXfN2nY35wMMwwyTi6dKVdDxHpB52YBNV3X3VzijA3zcvfJA9giydLAluSZC6jERAkQQ2zOHIHywyEGMvTFPT+lSbOcgRLo+TpONV1bUIK9wunSFOvDxLB723PhtgLlH6uWYf0HK7F6jYTdtvmpE=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579801114125578.0060439259652;
 Thu, 23 Jan 2020 09:38:34 -0800 (PST)
Received: from localhost ([::1]:33688 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugR6-00062y-FI
	for importer@patchew.org; Thu, 23 Jan 2020 12:38:32 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48341)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRY-0000D7-54
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRT-0003aP-10
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:52 -0500
Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:40250)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRS-0003ZD-RI
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:46 -0500
Received: by mail-wr1-x431.google.com with SMTP id c14so3536556wrn.7
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:46 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.44
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:45 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=eblYmalTC0fBvO9ZzHTdvSGAe+FYdbVrliGqrCf/xro=;
 b=fdnFD6CYOpkjB1F24hS4zxcc+QJG4WcDgSjjs4JfZLvkGvDCehPmi7xsIod/W/gc1W
 xBR6mBB6wbRL4bMlfnlhR2xU8Llk2vJzjDLaNczQCOXenT2uSVg0MyGp0b1JO0Ykpk82
 2eeCiP2vvMqyxNF46DEhTMCRN7HQ+6eMCeLlbzoG20CrharPZJdmDOEENdx+rXDk4tPy
 3aCKp4ZfEQDFs1+a9okRNFcdV4hld1vZ+rknqPIc+lYLwpxmXfc7NWNZs/sacEsvUk7k
 PlrvM254VptlBWe4Qjy95CWkECQ0Ijq66xKhXiNfkR2fSdHQ/0Fno4M8mObYbfd/69Uz
 wJYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=eblYmalTC0fBvO9ZzHTdvSGAe+FYdbVrliGqrCf/xro=;
 b=Eg5sRg2MwJFhfX/C5mH8FjSOKt9srx60VrV5hGqJPlxqA0eWwb4SbCXOOUC7qUMDzA
 74JFYsUG1u0jABZHOVqgZGGCuV8NFlNHwh6H0KSp73kbpBWiqFs9WqUZyrU/xc7EeHCX
 3DHM+iz+69c0a2Gc+j02ZygZ/6eXTZf3FIKgoQarkh6yINMWH+BLfncoOj4FIx6xNEKn
 v6+DzDQIvMusM9VRH8XERtA2BKlZNc/xIb9nx7z/upV99q1iC6QuC3+q6BZs3IMICMHq
 TM/LBD8DK2jj0/PukB+BLymn5aqPOAum4L5Sw0aTMj3PTKipeF5rMkc85SSC+dFqEmzo
 MW+g==
X-Gm-Message-State: APjAAAWJVut+yYtE+fRQ6JIjz1TnexbpgbTQt9E9Ry7E13DENVHoyrsi
 lQMsZMKrRwpUU2MZpcfYAOIySzwltVShAw==
X-Google-Smtp-Source: 
 APXvYqyN1+AxQkkuZzIY8uBGFRJY3TZLd2k9ioHb3uRJxhcCxLMpLlF+kE8npYMv1B/qY8X2pXuvsg==
X-Received: by 2002:adf:f6c8:: with SMTP id y8mr17903994wrp.167.1579793445634;
 Thu, 23 Jan 2020 07:30:45 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 02/20] target/arm: Fix PAuth sbox functions
Date: Thu, 23 Jan 2020 15:30:23 +0000
Message-Id: <20200123153041.4248-3-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::431
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Vincent Dehors <vincent.dehors@smile.fr>

In the PAC computation, sbox was applied over wrong bits.
As this is a 4-bit sbox, bit index should be incremented by 4 instead of 16.

Test vector from QARMA paper (https://eprint.iacr.org/2016/444.pdf) was
used to verify one computation of the pauth_computepac() function which
uses sbox2.

Launchpad: https://bugs.launchpad.net/bugs/1859713
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Vincent DEHORS <vincent.dehors@smile.fr>
Signed-off-by: Adrien GRASSEIN <adrien.grassein@smile.fr>
Message-id: 20200116230809.19078-2-richard.henderson@linaro.org
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/pauth_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/arm/pauth_helper.c b/target/arm/pauth_helper.c
index d3194f20437..0a5f41e10c5 100644
--- a/target/arm/pauth_helper.c
+++ b/target/arm/pauth_helper.c
@@ -89,7 +89,7 @@ static uint64_t pac_sub(uint64_t i)
     uint64_t o =3D 0;
     int b;
=20
-    for (b =3D 0; b < 64; b +=3D 16) {
+    for (b =3D 0; b < 64; b +=3D 4) {
         o |=3D (uint64_t)sub[(i >> b) & 0xf] << b;
     }
     return o;
@@ -104,7 +104,7 @@ static uint64_t pac_inv_sub(uint64_t i)
     uint64_t o =3D 0;
     int b;
=20
-    for (b =3D 0; b < 64; b +=3D 16) {
+    for (b =3D 0; b < 64; b +=3D 4) {
         o |=3D (uint64_t)inv_sub[(i >> b) & 0xf] << b;
     }
     return o;
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579801278; cv=none;
	d=zohomail.com; s=zohoarc;
	b=CjFb/5BZfZzpKq19tzxXwkTpb3L2iRxwL/vmI45PCAqTCuF7xhoVbHeI/908+W1/9xAn+wPLqtQ0pqHtD8d8ZEFuyUtdEtJUNR+y2tOziya9fVWmFu/pNnMh+6pWttuq6ymDh+iqCmKXbm3xKAI9wLfgMy0MzY2880pDRxwpZHI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579801278;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=qrKLsGzcwT4O0/FyrfhzQShN36qKk5yXw+x77PWIwL4=;
	b=OtzKf1S+DKc2wHfnPiVGa5cWX3lX9PpZ2XMTBvNMwDmGhJRuuIxdfgklc7UQmiakSf9pcR2uqRmdL9nXEEz/3CjeuaW3xPSZi5S/fcgXlECP2hdy0RNLM8+yldNxL3X4TMGJ1bFnYROYMXtzhwKs+WwQgUd3WOFwQzRnY4Hg51o=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579801278136843.4956113301874;
 Thu, 23 Jan 2020 09:41:18 -0800 (PST)
Received: from localhost ([::1]:33744 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugTi-0001In-Oi
	for importer@patchew.org; Thu, 23 Jan 2020 12:41:14 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48301)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRV-00008A-5Y
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:54 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRT-0003bv-U8
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:48 -0500
Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:33971)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRT-0003aW-N8
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:47 -0500
Received: by mail-wr1-x429.google.com with SMTP id t2so3585205wrr.1
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:47 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.45
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=qrKLsGzcwT4O0/FyrfhzQShN36qKk5yXw+x77PWIwL4=;
 b=Dxuey9eqU8BNgN/rfOhMxwNOy+mhRShS/6av3JmBN7I0XtFWi8rmPENPxeW1heDf67
 dAUF2KAOs6Yy7Al92WyrudPdDNX116xnOUwGxLinRw+5LUCjNkdJfmGhMQ8pW1igrFxj
 eTgw98xdOmwgRy3C3GPNxasnv7B4W3AEnJkK45xYedpjgfJmvUX2XTL3MU5nA74/el/M
 51Flc6EiGJxK6/qFv7s6y+IhLgA4xe827TicpmGMy2DkC1bIF8lGcgcjsGkI3pIr7DQT
 cKOo9m5UkOZzDO2/34luOluLNELHwpeiqjSLC53LIo82tJk5yZxQj/T2CdoqZJFzuyX7
 myCA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=qrKLsGzcwT4O0/FyrfhzQShN36qKk5yXw+x77PWIwL4=;
 b=PFvAPRjFS4xeETI/7Zo0ClyarU3b8xl43+BNOZnacjjHDjpJRWBZPRR4hssEWY+0Iv
 iG42sneD4VU+G5B3hiFP2ZjV6f6hr/ONj9xTf/DkkSMvpvb0ItMK7dqzp5/WeK/QrVhG
 kt+teqts9XQ3PdF++ZaP/qrEmFYgKtIsfflDpKkGnnfczt70uunLrJeZm8yXEpA4NVta
 J0OxtrLUttLhGy3iK+AxUL3WD+8J2wxFrgGq8YtE4RgO/BG+9PCxBnRmAN9UXo3E4LLS
 gdJa72IXZPt7KQgyEtHTDW6ZcNF4DMZ7z/BU32dEEsevrXmmBLgEQLWa+3D+JoBawP10
 aPgg==
X-Gm-Message-State: APjAAAU5/voGLwI69uqUy1yA8IUh1ccRq7iDAgC+xpEVISxm7ddBRoNS
 peP/OpqDgKsWl1HEASHxOZBhYoK2ocnWsg==
X-Google-Smtp-Source: 
 APXvYqzNz8I5w691LIQCjsdmO74oknmC2nn/EI/xXyWMgPWfQP2ha1i+1VZnS6qtHV+R0mXd3jE7FA==
X-Received: by 2002:adf:f3d1:: with SMTP id
 g17mr17349763wrp.378.1579793446506;
 Thu, 23 Jan 2020 07:30:46 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 03/20] tests/tcg/aarch64: Fix compilation parameters for
 pauth-%
Date: Thu, 23 Jan 2020 15:30:24 +0000
Message-Id: <20200123153041.4248-4-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::429
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

From: Richard Henderson <richard.henderson@linaro.org>

We were incorrectly requiring ARMv8.4 support for the pauth
tests, but Pointer Authentication is an ARMv8.3 extension.
Further, hiding the required architecture within asm() is
not correct.

Correct the architecture version requested, and specify it
in the cflags of the (cross-) compiler rather than in the asm.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daud=C3=A9 <philmd@redhat.com>
Message-id: 20200116230809.19078-3-richard.henderson@linaro.org
[PMM: tweaked commit message]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 tests/tcg/aarch64/Makefile.target | 1 +
 tests/tcg/aarch64/pauth-1.c       | 2 --
 tests/tcg/aarch64/pauth-2.c       | 2 --
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile=
.target
index df3fe8032c3..374c8d6830f 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -20,6 +20,7 @@ run-fcvt: fcvt
 # Pauth Tests
 AARCH64_TESTS +=3D pauth-1 pauth-2
 run-pauth-%: QEMU_OPTS +=3D -cpu max
+pauth-%: CFLAGS +=3D -march=3Darmv8.3-a
=20
 # Semihosting smoke test for linux-user
 AARCH64_TESTS +=3D semihosting
diff --git a/tests/tcg/aarch64/pauth-1.c b/tests/tcg/aarch64/pauth-1.c
index a3c1443cd07..ea0984ea823 100644
--- a/tests/tcg/aarch64/pauth-1.c
+++ b/tests/tcg/aarch64/pauth-1.c
@@ -2,8 +2,6 @@
 #include <sys/prctl.h>
 #include <stdio.h>
=20
-asm(".arch armv8.4-a");
-
 #ifndef PR_PAC_RESET_KEYS
 #define PR_PAC_RESET_KEYS  54
 #define PR_PAC_APDAKEY     (1 << 2)
diff --git a/tests/tcg/aarch64/pauth-2.c b/tests/tcg/aarch64/pauth-2.c
index 2fe030ba3da..9bba0beb639 100644
--- a/tests/tcg/aarch64/pauth-2.c
+++ b/tests/tcg/aarch64/pauth-2.c
@@ -1,8 +1,6 @@
 #include <stdint.h>
 #include <assert.h>
=20
-asm(".arch armv8.4-a");
-
 void do_test(uint64_t value)
 {
     uint64_t salt1, salt2;
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579803766; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ZXkhOZKCbc3g88B9emGHuX9ROln2KiNBRM8EtTMTD1PnDJNj916D6Igqbn9FUmVgVDmAPD1wAzEpIdkt1L0aYqqQk0nYUWlLcww0keYdy+j7s1wFppUqErtPAKYtAOuzbJn2CV/4GIeWO4iRpnO71cBvZ/acig7ECEUW+3OBFoA=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579803766;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=cLl48arpAObRN4ZJE2lzt8zWf4efO8tDW8tlBWZ2Av8=;
	b=hKdZZVyBEQ7nPbbu0ubRSxVXELQR0JYKYYDzGnOctza7vp9OkCiTlGQmqJ4c3HIyPHwuJix1inXynIMXxcV2PbbrqM7/rsu8AAk8kUCU8rbHIH/BGzCDKR4zx3m8QKmM4udaxSaQ9xo856N7cUqjE09piaWElr6YPXejkGsd75k=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579803766792573.3075919343675;
 Thu, 23 Jan 2020 10:22:46 -0800 (PST)
Received: from localhost ([::1]:34620 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iuh7t-0005jX-0c
	for importer@patchew.org; Thu, 23 Jan 2020 13:22:45 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48312)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRW-0000A1-AQ
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRU-0003d5-TJ
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:50 -0500
Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:36489)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRU-0003cA-Mu
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:48 -0500
Received: by mail-wm1-x334.google.com with SMTP id p17so2982873wma.1
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:48 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.46
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:46 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=cLl48arpAObRN4ZJE2lzt8zWf4efO8tDW8tlBWZ2Av8=;
 b=lqd+1yYXZihb2iQ9Xabrclijbd426prqbmbgMIU8Be4PAkkEEouwRwoXjjGBT7PDXf
 1o1LUun/MgyU0rYzKu/xPBZF3UkvTya/f5dPYafq77SSHoCgMbbDg62bU73GjV7kyEr6
 j9ltT5hb79QFHn2Ew5fJ66HBGy0QKSw97srhuAXlpNiy2jnjAlzto4D+0+wxyN6Nj0sQ
 qcS5houfX23ipIgWHgp6wVTGosTbwmZ+FPSPSI+EcZPQFMB6rCIT4QIZH0/CQJHzVzrK
 2v4MKF3AMMSW7LGHQEtXxaBaeRPaxVWJMFj0yfv0R5nWUN5d5+RKa+ka0W1lsR/iVVfV
 TzNA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=cLl48arpAObRN4ZJE2lzt8zWf4efO8tDW8tlBWZ2Av8=;
 b=m6Gt5n+J64srNBk5qWuBfNU59jSOw26u8ib3LjIxHte3GeJESSpLQtq5EtWtH8N4Py
 VMg5bYJvphhMR2Po/CxFX7lejIN2c739Jyqfuzc4ktkHkYGWd7voP0CYfCmDhxyayzaL
 +cUgEH9lauvipkbdIrhytyVRaqFHKB6kdrvgNllx2Y9Q0mvOmtC9KeIfQ38G9WE/RwEA
 ni0MpOzhab4OSPwxQfZE75qdrSXv7PMAX7xV+26r05pIG0AgPy2tBFlQZyZGulUwJ+Mf
 DGh4BF80osK7rxEFMhslHiMg4f7acKQZx0rV+jFMmS4gvztPOR+ewlEwqLgDsByRvD7n
 lOXQ==
X-Gm-Message-State: APjAAAWnNml92IeVixvG/qgPawVqQnMUP51eACYsHYMnrqlK2r5On0QG
 VpUWaa7vUJ+aPLHxwE648cTFl7SEvyGz8Q==
X-Google-Smtp-Source: 
 APXvYqwd5lfaXPraLqgbsUGr14ZlZmPapyU4NI+czk5c8Lw/CrQI0ClScVxC0bP0PsM/1QwdqPrrxQ==
X-Received: by 2002:a7b:c7d4:: with SMTP id z20mr4685005wmk.42.1579793447382;
 Thu, 23 Jan 2020 07:30:47 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 04/20] tests/tcg/aarch64: Add pauth-3
Date: Thu, 23 Jan 2020 15:30:25 +0000
Message-Id: <20200123153041.4248-5-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::334
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

This is the test vector from the QARMA paper, run through PACGA.

Suggested-by: Vincent Dehors <vincent.dehors@smile.fr>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200116230809.19078-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 tests/tcg/aarch64/Makefile.softmmu-target |  5 ++-
 tests/tcg/aarch64/system/pauth-3.c        | 40 +++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/aarch64/system/pauth-3.c

diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/=
Makefile.softmmu-target
index 7b4eede3f07..f6b5121f5ce 100644
--- a/tests/tcg/aarch64/Makefile.softmmu-target
+++ b/tests/tcg/aarch64/Makefile.softmmu-target
@@ -61,4 +61,7 @@ run-memory-replay: memory-replay run-memory-record
 	   	  $(QEMU_OPTS) memory, \
 	  "$< on $(TARGET_NAME)")
=20
-EXTRA_TESTS+=3Dmemory-record memory-replay
+run-pauth-3: pauth-3
+pauth-3: CFLAGS +=3D -march=3Darmv8.3-a
+
+EXTRA_TESTS+=3Dmemory-record memory-replay pauth-3
diff --git a/tests/tcg/aarch64/system/pauth-3.c b/tests/tcg/aarch64/system/=
pauth-3.c
new file mode 100644
index 00000000000..42eff4d5eae
--- /dev/null
+++ b/tests/tcg/aarch64/system/pauth-3.c
@@ -0,0 +1,40 @@
+#include <inttypes.h>
+#include <minilib.h>
+
+int main()
+{
+    /*
+     * Test vector from QARMA paper (https://eprint.iacr.org/2016/444.pdf)
+     * to verify one computation of the pauth_computepac() function,
+     * which uses sbox2.
+     *
+     * Use PACGA, because it returns the most bits from ComputePAC.
+     * We still only get the most significant 32-bits of the result.
+     */
+
+    static const uint64_t d[5] =3D {
+        0xfb623599da6e8127ull,
+        0x477d469dec0b8762ull,
+        0x84be85ce9804e94bull,
+        0xec2802d4e0a488e9ull,
+        0xc003b93999b33765ull & 0xffffffff00000000ull
+    };
+    uint64_t r;
+
+    asm("msr apgakeyhi_el1, %[w0]\n\t"
+        "msr apgakeylo_el1, %[k0]\n\t"
+        "pacga %[r], %[P], %[T]"
+        : [r] "=3Dr"(r)
+        : [P] "r" (d[0]),
+          [T] "r" (d[1]),
+          [w0] "r" (d[2]),
+          [k0] "r" (d[3]));
+
+    if (r =3D=3D d[4]) {
+        ml_printf("OK\n");
+        return 0;
+    } else {
+        ml_printf("FAIL: %lx !=3D %lx\n", r, d[4]);
+        return 1;
+    }
+}
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579799322; cv=none;
	d=zohomail.com; s=zohoarc;
	b=PRaR7c+I1th39WkX8ZCV8WygHeonFfedNmz+3eNAa0U7wT5NHrgGZXHv25zXYU4rmijoligDP3zcXJNLPh/xd3CZS8xsrSNI/EBNDeG24+OBxwwCjvCFH7xlBPgRVS0KrcM9+zCa6SQazDaKrbKMTTr29FNN32HSNyKo27qORyY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579799322;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=cgmfL+4gTnqZBGjqUeHy8Uwc1+lP8StkbgIKZkWqXCE=;
	b=Q7m6Au03oNfW76YcYXS1WAvr4k1yp5LLBblc9OjkDhYwC5ZndvgH4/cl6mRjxbeAonqIii3BiZqdmgnWwPrax1PsnOqwVKBXwyEUeovKEoPYFMXr3IeIw1LkiYelgv8TusZ5soxtnL22RBOSeIINxHJYv0/rT0N2j4vvWsMBGQ4=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579799322571261.5608604809338;
 Thu, 23 Jan 2020 09:08:42 -0800 (PST)
Received: from localhost ([::1]:33052 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iufyC-0002OI-HR
	for importer@patchew.org; Thu, 23 Jan 2020 12:08:40 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48332)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRX-0000Bl-L5
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRW-0003eU-5L
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:51 -0500
Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:36479)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRV-0003d9-U8
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:50 -0500
Received: by mail-wm1-x329.google.com with SMTP id p17so2982946wma.1
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:49 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.47
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=cgmfL+4gTnqZBGjqUeHy8Uwc1+lP8StkbgIKZkWqXCE=;
 b=PynxNDsZuaPABhERy5hHA3Tylf1nEDvaFSAQZoCrk58OosLM2+LszDlJ1m0WOBiP37
 Fl9f9yTPSPSnuL9+yFX3R5UDZC4UqFgU++Tj+dTEVirKKzBaZDJT6M/MLpbarILUr3jm
 1/lOn5BsBEPGBavGgR59RAR31LaOeQ4o9mTN1YyUYWX1A/hSquHolqqsniuMuZxnkUb9
 aH2uqPw/7HGgqxmUtsk7Li+HbqJzhJVa27cX4tl4bUsqh5qTBHVs7PnMVKc1ujqi+P00
 hrsl6nby+Vvk/G2RPH2svMgyQoIC22auUwfr1Kd0pwYVBe0CenZi8V20l3NpVZEs8E8D
 WFRw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=cgmfL+4gTnqZBGjqUeHy8Uwc1+lP8StkbgIKZkWqXCE=;
 b=KtjIPszAh30n508ZN8ANFNlQHx5A/TUHglMn+SjuZlqHsIRakvjI0nMO6yVCzymRtc
 2tSXCD/FV0yvGvnNQvfn5bdMhE9fgy1ILKSUsJE7L5YPksLzKwX5/N4MfLh0YKAxrLrt
 SUw3UN/vO0zco60HmYEG3VprLg1BRr+LtZRMlrKNxA0lIH7uEq3G3ooGMV3qZT6d6QTA
 c/qzqZlPjtLugWyyDOOdq2BtDGc27XHJ/wXwOGtGdeUGfo7b64LR75AB0ZMqjw3xNqTL
 nLxqIsUHyXV9/lDuOyuMMnRJY2uNEiOzR9EBIDyDzKNjNxpjP1PZTEccXvtLzrKsdnIc
 5L7Q==
X-Gm-Message-State: APjAAAW/Yoi76WnJGHAWlAG30yTKViSr7rxU+WrpAIbysDc2+xHaj4o6
 JvfdmVmIixfrW9A3z+ZwPQRnbBvhTDYh0w==
X-Google-Smtp-Source: 
 APXvYqz+b4qX5P0By5uQzBXXZ9imLSmd91t8Omo1Xf9ZZ3ujFIo0hgQTv0Y8POvqo3gqrWOGjOjXmg==
X-Received: by 2002:a7b:cb01:: with SMTP id u1mr4970324wmj.156.1579793448353;
 Thu, 23 Jan 2020 07:30:48 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 05/20] tests/tcg/aarch64: Add pauth-4
Date: Thu, 23 Jan 2020 15:30:26 +0000
Message-Id: <20200123153041.4248-6-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::329
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Perform the set of operations and test described in LP 1859713.

Suggested-by: Adrien GRASSEIN <adrien.grassein@smile.fr>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200116230809.19078-5-richard.henderson@linaro.org
[PMM: fixed hard-coded tabs]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 tests/tcg/aarch64/Makefile.target |  2 +-
 tests/tcg/aarch64/pauth-4.c       | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 tests/tcg/aarch64/pauth-4.c

diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile=
.target
index 374c8d6830f..efa67cf1e9e 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -18,7 +18,7 @@ run-fcvt: fcvt
 	$(call diff-out,$<,$(AARCH64_SRC)/fcvt.ref)
=20
 # Pauth Tests
-AARCH64_TESTS +=3D pauth-1 pauth-2
+AARCH64_TESTS +=3D pauth-1 pauth-2 pauth-4
 run-pauth-%: QEMU_OPTS +=3D -cpu max
 pauth-%: CFLAGS +=3D -march=3Darmv8.3-a
=20
diff --git a/tests/tcg/aarch64/pauth-4.c b/tests/tcg/aarch64/pauth-4.c
new file mode 100644
index 00000000000..1040e92aec3
--- /dev/null
+++ b/tests/tcg/aarch64/pauth-4.c
@@ -0,0 +1,25 @@
+#include <stdint.h>
+#include <assert.h>
+
+int main()
+{
+  uintptr_t x, y;
+
+  asm("mov %0, lr\n\t"
+      "pacia %0, sp\n\t"        /* sigill if pauth not supported */
+      "eor %0, %0, #4\n\t"      /* corrupt single bit */
+      "mov %1, %0\n\t"
+      "autia %1, sp\n\t"        /* validate corrupted pointer */
+      "xpaci %0\n\t"            /* strip pac from corrupted pointer */
+      : "=3Dr"(x), "=3Dr"(y));
+
+  /*
+   * Once stripped, the corrupted pointer is of the form 0x0000...wxyz.
+   * We expect the autia to indicate failure, producing a pointer of the
+   * form 0x000e....wxyz.  Use xpaci and !=3D for the test, rather than
+   * extracting explicit bits from the top, because the location of the
+   * error code "e" depends on the configuration of virtual memory.
+   */
+  assert(x !=3D y);
+  return 0;
+}
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579800969; cv=none;
	d=zohomail.com; s=zohoarc;
	b=LdBviBTtS1lrMHYbp57hbQXawLdaOHGNV7Fl9SGEnylq3BbihL4EE/Ws/0hUJSrug9AcCySh2g29qcE8iToPogHYk4VZMRdwR1tUAndedqPH6XsVCEeWuqkKgthxEBtuCluehk0bnjM4f9o3YSHqdrQX6Ez1rzByaF8egSnkIWc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579800969;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=0v6Oo7itTA9z3UlsukmW0dxT629fmHL/fJ9CqJZVM0Q=;
	b=LqDD1FM3ObavupGnKsoerKjVvadI0xExYfSzbBggPqw8kfE+JFb3Fal1PX75aekqBTR3BO6vhL/PLyJeAQQ94nQ4O9oxKcuh/6QeGJEiJiBAoQcTtE1xKE9ylsuDdBLhNCE2H9Dpkam8VQrzuQuxvT8XvXmoidgyWcpiUnNdOE4=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579800969806629.5177655339812;
 Thu, 23 Jan 2020 09:36:09 -0800 (PST)
Received: from localhost ([::1]:33602 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugOj-0002T5-NN
	for importer@patchew.org; Thu, 23 Jan 2020 12:36:05 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48335)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRX-0000CA-Pl
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:52 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRW-0003fD-I5
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:51 -0500
Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:34460)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRW-0003eB-Bj
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:50 -0500
Received: by mail-wm1-x329.google.com with SMTP id s144so2119888wme.1
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:50 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.48
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:48 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=0v6Oo7itTA9z3UlsukmW0dxT629fmHL/fJ9CqJZVM0Q=;
 b=NSgySUIjhH0gassV4TETqVw55UdiMwbDFtil0y49U7CDKBGjFm7w39zgqDB9cXXo0F
 sO9omRtAkGpTU/m9C8jpzXihTnSZUVMsjGMNWvXU20Fr+v1g7S4Aydpk8qDDLg/FV5NJ
 AZe3x/jpx3jYF6DqMKV7AgrOBemL1R0k6h+pq8Gb63GS8ggeeviFwn4wP3eXht2VJ3nV
 wtdIFm98T3qFTeqAjeb4kgo8dBRfWDt9yZBfEVWc0ImEGqEHUha9jNyNTSQ1FtEI4Ugi
 X/CmuHpysSk6xWrSGuw3Y7VTNXgy6x2B5Gn8awzheHJXuToiwfSHF3HbOAAALoRgEyK7
 Sm5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=0v6Oo7itTA9z3UlsukmW0dxT629fmHL/fJ9CqJZVM0Q=;
 b=ajSA/agUJATfNKVQWAe6cRg8ET/tA1cnMWfgq8rt21mwelE/s3tD5pYIa9Z0o8agAC
 t0gqGY9IKDqA/wq6L7PES9J7IQ7kFnf/Ps5KOIooEomBy40+Fc47C+2d6gROc5og2sdc
 Ep3P8r/71kSDgGtKiMB0TLAB7+ByUQHI330uQkDSb0FRjm+dTIGYMVSVDeaBFOB/g2la
 FOhRju8WQ8UrDccppzXBqkNrNrf/6zpiDrfiXRQH1p1YszDzXz2ydX868+lSB7YcvCUG
 ItK7a1eKVscyCA+TyCzXEIZT//7ccVO4ttDFkAXXKUbm2aXUdZM3+OF55IWOJI2XbIj/
 zK4Q==
X-Gm-Message-State: APjAAAX9SFC8IvJoJD8riDEVgILe6KrtBWLIDSFs87WwXLn0b9Nsktkg
 RU/Ra666NpGz2apZDbDWwOjJRCQaf8PTww==
X-Google-Smtp-Source: 
 APXvYqyYPZNZthOxtxEUploezbUx+7q+VQ1bCfTHo9NKm/4smRBj9eMpezUF/89ry+2+COpxcdm7pQ==
X-Received: by 2002:a1c:dcd5:: with SMTP id t204mr4789067wmg.34.1579793449227;
 Thu, 23 Jan 2020 07:30:49 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 06/20] hw/acpi: Remove extra indent in ACPI GED hotplug cb
Date: Thu, 23 Jan 2020 15:30:27 +0000
Message-Id: <20200123153041.4248-7-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::329
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Keqian Zhu <zhukeqian1@huawei.com>

There is extra indent in ACPI GED hotplug cb that should be
deleted.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
Message-id: 20200120012755.44581-2-zhukeqian1@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/acpi/generic_event_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index 9cee90cc706..55eb29d80a5 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -175,7 +175,7 @@ static void acpi_ged_device_plug_cb(HotplugHandler *hot=
plug_dev,
     AcpiGedState *s =3D ACPI_GED(hotplug_dev);
=20
     if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM)) {
-            acpi_memory_plug_cb(hotplug_dev, &s->memhp_state, dev, errp);
+        acpi_memory_plug_cb(hotplug_dev, &s->memhp_state, dev, errp);
     } else {
         error_setg(errp, "virt: device plug request for unsupported device"
                    " type: %s", object_get_typename(OBJECT(dev)));
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579799508; cv=none;
	d=zohomail.com; s=zohoarc;
	b=T+BF0H58dgSISqrcJF9cTuoReAGJuYq0eWAVO4HnSkHJSeh2xDY3uor/lzg7Y2fwYSi6wKNN2Jbh1YokmYsHvSBdbyeaKEVVaK3zFjfs3C35dDvcs1Izjn/13aeeNi+HnyqMeuAf74GjgRZXeQd00xJmcuVWoZn7/OL1T4igA+M=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579799508;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=YHdtbMY45khjtvmWy6PilEpBxwmOSqr/+Trm1VbjU/k=;
	b=DoYPPooaVcw9fPw6SC1NSXci+jDe94jxJ7rNpFyI4OrFkuSt2JV9Vc11Zsuz202F7bSOmavmRBTA/YoVsyopZJxeoRxA9PgAvBpsDKEb6M4RFtx/jyqNHIU4TvcOediF5DfBpoplizTvqs9zEjsRCt3An85zczWPIP00OEWMnUY=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579799508881284.0240003916505;
 Thu, 23 Jan 2020 09:11:48 -0800 (PST)
Received: from localhost ([::1]:33100 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iug1D-0006VL-4F
	for importer@patchew.org; Thu, 23 Jan 2020 12:11:47 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48354)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRY-0000Dt-ND
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRX-0003gl-IA
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:52 -0500
Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:50264)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRX-0003fb-CK
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:51 -0500
Received: by mail-wm1-x32d.google.com with SMTP id a5so3022190wmb.0
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:51 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.49
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:49 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=YHdtbMY45khjtvmWy6PilEpBxwmOSqr/+Trm1VbjU/k=;
 b=kN0r8jOn2k2EbBnuHC37FLkc0sGqBGWaedKaBBKcC9T/M8F8YpA71HbPQ3pblRiGHG
 yYLMUCxOhqC+VuTp8RYszQnI31LTpZkKQZ5TIzvLv2E3ncRYJJ9uUjJdxjLaa1ZoRrVk
 QfvzPag7Tlnyjxc50pddeVh0bFzwQFzqf4j8NWkYMb/Ndfs57iNzMVIfvgiRhlhV70Rh
 rzFO0Xd9FxB5zwoQLQC1tVP0j/XQgyQT70qajV24B53BSZ4noAsWc45FnhZGUaK4V7kS
 nE1JlAMeqGzRRNh0TPQWPyvpFV/B8niEjWUkYcuB0z4+eVMupy+sBd/BJ/RYWZEfRwvm
 3KQA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=YHdtbMY45khjtvmWy6PilEpBxwmOSqr/+Trm1VbjU/k=;
 b=VYtN/QU0YrRNLDPGR+msWwiXesm+OxA7E21Chz28ejNIhDUlXIFh9VxRfmRKnhwLNw
 i1MyGNh6f8YUKskNb7veBwo4WPxvFA4HOVHHO8qGLDhmJkocnUcQrWBM7pw+zT8Lejc6
 CqfPTEvS1jase2y25wk1JWvAe3dw9QfxlKjzw/gjzvKf7LQW9F5tsgLHf2IGN8gn3hhV
 LeXeOm7g51UGLTzVc0pW/KaO1dJprlSTYTSCTcPNSNWvz8g3QJx+jr57APoWwryerwWW
 94do4vACdAO8oKVZraNcD7Izwf+pAReYSv/fjin/fTodohA8sZ6jPskv8/Evx9LeWuV9
 8ljg==
X-Gm-Message-State: APjAAAU2IUDNd9XKgcKT2cUi50WQvSzASjsWLOUqFbJk1MqSsXaz/PC3
 FmAXNQIBDk36tqmrnXP1r2kGy5W+XE1UUA==
X-Google-Smtp-Source: 
 APXvYqwjxwQkroBTOvCaAEqq0yXBQRrszMHDMElE81oTp4+W7XakNG9LWroo/KzKdZVP37kfEC+yqg==
X-Received: by 2002:a1c:a406:: with SMTP id n6mr4673956wme.40.1579793450178;
 Thu, 23 Jan 2020 07:30:50 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 07/20] hw/arm: Use helper function to trigger hotplug handler
 plug
Date: Thu, 23 Jan 2020 15:30:28 +0000
Message-Id: <20200123153041.4248-8-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::32d
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Keqian Zhu <zhukeqian1@huawei.com>

We can use existing helper function to trigger hotplug handler
plug, which makes code clearer.

Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Keqian Zhu <zhukeqian1@huawei.com>
Message-id: 20200120012755.44581-3-zhukeqian1@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/virt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 39ab5f47e0b..656b0081c2c 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -1934,7 +1934,6 @@ static void virt_memory_pre_plug(HotplugHandler *hotp=
lug_dev, DeviceState *dev,
 static void virt_memory_plug(HotplugHandler *hotplug_dev,
                              DeviceState *dev, Error **errp)
 {
-    HotplugHandlerClass *hhc;
     VirtMachineState *vms =3D VIRT_MACHINE(hotplug_dev);
     Error *local_err =3D NULL;
=20
@@ -1943,8 +1942,9 @@ static void virt_memory_plug(HotplugHandler *hotplug_=
dev,
         goto out;
     }
=20
-    hhc =3D HOTPLUG_HANDLER_GET_CLASS(vms->acpi_dev);
-    hhc->plug(HOTPLUG_HANDLER(vms->acpi_dev), dev, &error_abort);
+    hotplug_handler_plug(HOTPLUG_HANDLER(vms->acpi_dev),
+                         dev, &error_abort);
+
 out:
     error_propagate(errp, local_err);
 }
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579801645; cv=none;
	d=zohomail.com; s=zohoarc;
	b=AZZmnoeBGuplgQOJ51dQ2krqyd8uwGTfP9AIM6GSIKWNERMf5qcw27NV0bNc+kQuqM2OBEfWXbhRtKLUU65WCVdUvANfIf2kTbWAdiwWPE7lAlU1gfRN7dkwfBtfOhqP9EBTL7niozDoJJck+3nkbGwhDcK84oAplUAM1JSDpF8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579801645;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=JhkqBy+Vx72L/6CNPvdJNHFbbYv4q6aoxO+OdL5kZIA=;
	b=IwLItnnKuzG8CetTKtf40nX9An0ou2y4Mpht5K0qzPpZBNhSDZR3fc7gwGNYiMqTwtEEDj+AtsmIUZ1e19GmI8iOqn3i4EdlowtP2psG9/4iG3hLMfwi7aZPfooED9akJi1gqAbFbjv7lf4FCKIxrJC9J09xh15e5JnvkUoBodc=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579801645699139.38087909343665;
 Thu, 23 Jan 2020 09:47:25 -0800 (PST)
Received: from localhost ([::1]:33920 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugZf-0001Dn-Ek
	for importer@patchew.org; Thu, 23 Jan 2020 12:47:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48395)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRd-0000Nk-P2
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRZ-0003iT-RM
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:57 -0500
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:50266)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRZ-0003hp-HF
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:53 -0500
Received: by mail-wm1-x32f.google.com with SMTP id a5so3022309wmb.0
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:53 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.50
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:50 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=JhkqBy+Vx72L/6CNPvdJNHFbbYv4q6aoxO+OdL5kZIA=;
 b=rHv4yEsnV7/hYyvVsRMGlUZuI9qcYUuo9Bpy6sIVxAlq593GXsXOgTIxEEAWPVGBd4
 ydz9lklCe9MuyKfoPuDfYpEeJ3SBPzsGwM2kZv8YUrHxwtST+V630BHVnstjzSF62LNp
 qs2nDMpYeUJBn1G4J3vv1j4U82hb1tqvpWqu0RsAX/3WCd42mVm/+1k9M3aJ33z87hsF
 pAjY6xTPXHyt4GlMqxpCbSURvLb2nWrp9Zd+Ic7TCHJQ1hrxQ0BWldeQonW4q5x/0c4n
 l6+I3BRV3wpW9+xBSgWEG2b5gg9nqUNEWcQvnBBqkVZugCd0msvXtrpb80GcAYL/QVVs
 6khw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=JhkqBy+Vx72L/6CNPvdJNHFbbYv4q6aoxO+OdL5kZIA=;
 b=DCyx5J+RQr+7rByEeewkQpjyjf+aPfTsafPsxSfZuPplRZJEuM0NI7CowGnAAE5TC8
 bxPux4KDW/F9KAGISWPFVheNGbB92fsMFl/O8i1+FUFx3S/cZAj+ra96ak5URJqB2mlU
 CUZ2OINh/W4DicQEIpO+AIXz0nx9cN4/0Ne8v2QZduXeTi5rHoEXvBKfJkJS0M5jgmhB
 sW/+0L6TtyUANuc6b3bICCGOF9llhM5Cxn4jUdnguGiAKF+3ZO4rrf005DqdO54EkMAn
 biAIYIz0MFY7XnHlDmCLg3CFVZZlt9/UZOBDErPk++zFON6R5sfCqebSk1EUL+J/qZKw
 oHWg==
X-Gm-Message-State: APjAAAXBq1nasYwj3EkO9aWxs/bsQg7DGLXhaREeC+ZSlJsNQXZtPN2o
 2udSnFiBzn1cH0MzrADsf/dAdGJgLCKe2Q==
X-Google-Smtp-Source: 
 APXvYqy90Ru3wbmJLSlhzUkaTzqtCYvcdGJxptyTbR4t19Z2gcXFupmxi4SKs3nfdotvJRRfkhHeAQ==
X-Received: by 2002:a05:600c:108a:: with SMTP id
 e10mr4660896wmd.38.1579793451462;
 Thu, 23 Jan 2020 07:30:51 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 08/20] qemu-nbd: Convert invocation documentation to rST
Date: Thu, 23 Jan 2020 15:30:29 +0000
Message-Id: <20200123153041.4248-9-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::32f
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

The qemu-nbd documentation is currently in qemu-nbd.texi in Texinfo
format, which we present to the user as:
 * a qemu-nbd manpage
 * a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to the user as:
 * a qemu-nbd manpage
 * part of the interop/ Sphinx manual

This follows the same pattern as commit 27a296fce982 did for the
qemu-ga manpage.

All the content of the old manpage is retained, except that I have
dropped the "This is free software; see the source for copying
conditions.  There is NO warranty..." text that was in the old AUTHOR
section; Sphinx's manpage builder doesn't expect that much text in
the AUTHOR section, and since none of our other manpages have it it
seems easiest to delete it rather than try to figure out where else
in the manpage to put it.

The only other textual change is that I have had to give the
--nocache option its own description ("Equivalent to --cache=3Dnone")
because Sphinx doesn't have an equivalent of using item/itemx
to share a description between two options.

Some minor aspects of the formatting have changed, to suit what is
easiest for Sphinx to output. (The most notable is that Sphinx
option section option syntax doesn't support '--option foo=3Dbar'
with bar underlined rather than bold, so we have to switch to
'--option foo=3DBAR' instead.)

The contents of qemu-option-trace.texi are now duplicated in
docs/interop/qemu-option-trace.rst.inc, until such time as we complete
the conversion of the other files which use it; since it has had only
3 changes in 3 years, this shouldn't be too awkward a burden.
(We use .rst.inc because if this file fragment has a .rst extension
then Sphinx complains about not seeing it in a toctree.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20200116141511.16849-2-peter.maydell@linaro.org
---
 Makefile                               |  16 +-
 MAINTAINERS                            |   1 +
 docs/interop/conf.py                   |   4 +-
 docs/interop/index.rst                 |   1 +
 docs/interop/qemu-nbd.rst              | 263 +++++++++++++++++++++++++
 docs/interop/qemu-option-trace.rst.inc |  30 +++
 qemu-doc.texi                          |   6 -
 qemu-nbd.texi                          | 214 --------------------
 qemu-option-trace.texi                 |   4 +
 9 files changed, 313 insertions(+), 226 deletions(-)
 create mode 100644 docs/interop/qemu-nbd.rst
 create mode 100644 docs/interop/qemu-option-trace.rst.inc
 delete mode 100644 qemu-nbd.texi

diff --git a/Makefile b/Makefile
index 6562b0dc970..b4a6c28107d 100644
--- a/Makefile
+++ b/Makefile
@@ -339,7 +339,9 @@ MANUAL_BUILDDIR :=3D docs
 endif
=20
 ifdef BUILD_DOCS
-DOCS=3Dqemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 $(MANUAL_BU=
ILDDIR)/interop/qemu-ga.8
+DOCS=3Dqemu-doc.html qemu-doc.txt qemu.1 qemu-img.1
+DOCS+=3D$(MANUAL_BUILDDIR)/interop/qemu-nbd.8
+DOCS+=3D$(MANUAL_BUILDDIR)/interop/qemu-ga.8
 DOCS+=3Ddocs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/=
interop/qemu-qmp-ref.7
 DOCS+=3Ddocs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/in=
terop/qemu-ga-ref.7
 DOCS+=3Ddocs/qemu-block-drivers.7
@@ -829,7 +831,7 @@ ifdef CONFIG_POSIX
 ifeq ($(CONFIG_TOOLS),y)
 	$(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
-	$(INSTALL_DATA) qemu-nbd.8 "$(DESTDIR)$(mandir)/man8"
+	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/interop/qemu-nbd.8 "$(DESTDIR)$(mandir=
)/man8"
 endif
 ifdef CONFIG_TRACE_SYSTEMTAP
 	$(INSTALL_DATA) scripts/qemu-trace-stap.1 "$(DESTDIR)$(mandir)/man1"
@@ -1007,7 +1009,9 @@ sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MAN=
UAL_BUILDDIR)/interop/index
 # a single doctree: https://github.com/sphinx-doc/sphinx/issues/2946
 build-manual =3D $(call quiet-command,CONFDIR=3D"$(qemu_confdir)" sphinx-b=
uild $(if $(V),,-q) -W -b $2 -D version=3D$(VERSION) -D release=3D"$(FULL_V=
ERSION)" -d .doctrees/$1-$2 $(SRC_PATH)/docs/$1 $(MANUAL_BUILDDIR)/$1 ,"SPH=
INX","$(MANUAL_BUILDDIR)/$1")
 # We assume all RST files in the manual's directory are used in it
-manual-deps =3D $(wildcard $(SRC_PATH)/docs/$1/*.rst) $(SRC_PATH)/docs/$1/=
conf.py $(SRC_PATH)/docs/conf.py
+manual-deps =3D $(wildcard $(SRC_PATH)/docs/$1/*.rst) \
+              $(wildcard $(SRC_PATH)/docs/$1/*.rst.inc) \
+              $(SRC_PATH)/docs/$1/conf.py $(SRC_PATH)/docs/conf.py
=20
 $(MANUAL_BUILDDIR)/devel/index.html: $(call manual-deps,devel)
 	$(call build-manual,devel,html)
@@ -1021,6 +1025,9 @@ $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-de=
ps,specs)
 $(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
 	$(call build-manual,interop,man)
=20
+$(MANUAL_BUILDDIR)/interop/qemu-nbd.8: $(call manual-deps,interop)
+	$(call build-manual,interop,man)
+
 $(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version=
.h
 	@mkdir -p "$(MANUAL_BUILDDIR)"
 	$(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
@@ -1048,7 +1055,6 @@ qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.=
texi qemu-monitor-info.texi
 qemu.1: qemu-option-trace.texi
 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
-qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
 docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
 docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
 scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
@@ -1059,7 +1065,7 @@ pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/=
interop/qemu-ga-ref.pdf
 txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.t=
xt
=20
 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
-	qemu-img.texi qemu-nbd.texi qemu-options.texi \
+	qemu-img.texi qemu-options.texi \
 	qemu-tech.texi qemu-option-trace.texi \
 	qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \
 	qemu-monitor-info.texi docs/qemu-block-drivers.texi \
diff --git a/MAINTAINERS b/MAINTAINERS
index 2c768ed3d8d..d9798c20c06 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2519,6 +2519,7 @@ F: include/block/nbd*
 F: qemu-nbd.*
 F: blockdev-nbd.c
 F: docs/interop/nbd.txt
+F: docs/interop/qemu-nbd.rst
 T: git https://repo.or.cz/qemu/ericb.git nbd
=20
 NFS
diff --git a/docs/interop/conf.py b/docs/interop/conf.py
index e87b8c22bec..40b1ad811de 100644
--- a/docs/interop/conf.py
+++ b/docs/interop/conf.py
@@ -18,5 +18,7 @@ html_theme_options['description'] =3D u'System Emulation =
Management and Interopera
 # (source start file, name, description, authors, manual section).
 man_pages =3D [
     ('qemu-ga', 'qemu-ga', u'QEMU Guest Agent',
-     ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8)
+     ['Michael Roth <mdroth@linux.vnet.ibm.com>'], 8),
+    ('qemu-nbd', 'qemu-nbd', u'QEMU Disk Network Block Device Server',
+     ['Anthony Liguori <anthony@codemonkey.ws>'], 8)
 ]
diff --git a/docs/interop/index.rst b/docs/interop/index.rst
index 049387ac6de..c28f7785a55 100644
--- a/docs/interop/index.rst
+++ b/docs/interop/index.rst
@@ -18,5 +18,6 @@ Contents:
    live-block-operations
    pr-helper
    qemu-ga
+   qemu-nbd
    vhost-user
    vhost-user-gpu
diff --git a/docs/interop/qemu-nbd.rst b/docs/interop/qemu-nbd.rst
new file mode 100644
index 00000000000..873bb9e17d5
--- /dev/null
+++ b/docs/interop/qemu-nbd.rst
@@ -0,0 +1,263 @@
+QEMU Disk Network Block Device Server
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+Synopsis
+--------
+
+**qemu-nbd** [*OPTION*]... *filename*
+
+**qemu-nbd** -L [*OPTION*]...
+
+**qemu-nbd** -d *dev*
+
+Description
+-----------
+
+Export a QEMU disk image using the NBD protocol.
+
+Other uses:
+
+- Bind a /dev/nbdX block device to a QEMU server (on Linux).
+- As a client to query exports of a remote NBD server.
+
+Options
+-------
+
+.. program:: qemu-nbd
+
+*filename* is a disk image filename, or a set of block
+driver options if ``--image-opts`` is specified.
+
+*dev* is an NBD device.
+
+.. option:: --object type,id=3DID,...props...
+
+  Define a new instance of the *type* object class identified by *ID*.
+  See the :manpage:`qemu(1)` manual page for full details of the properties
+  supported. The common object types that it makes sense to define are the
+  ``secret`` object, which is used to supply passwords and/or encryption
+  keys, and the ``tls-creds`` object, which is used to supply TLS
+  credentials for the qemu-nbd server or client.
+
+.. option:: -p, --port=3DPORT
+
+  TCP port to listen on as a server, or connect to as a client
+  (default ``10809``).
+
+.. option:: -o, --offset=3DOFFSET
+
+  The offset into the image.
+
+.. option:: -b, --bind=3DIFACE
+
+  The interface to bind to as a server, or connect to as a client
+  (default ``0.0.0.0``).
+
+.. option:: -k, --socket=3DPATH
+
+  Use a unix socket with path *PATH*.
+
+.. option:: --image-opts
+
+  Treat *filename* as a set of image options, instead of a plain
+  filename. If this flag is specified, the ``-f`` flag should
+  not be used, instead the :option:`format=3D` option should be set.
+
+.. option:: -f, --format=3DFMT
+
+  Force the use of the block driver for format *FMT* instead of
+  auto-detecting.
+
+.. option:: -r, --read-only
+
+  Export the disk as read-only.
+
+.. option:: -P, --partition=3DNUM
+
+  Deprecated: Only expose MBR partition *NUM*.  Understands physical
+  partitions 1-4 and logical partition 5. New code should instead use
+  :option:`--image-opts` with the raw driver wrapping a subset of the
+  original image.
+
+.. option:: -B, --bitmap=3DNAME
+
+  If *filename* has a qcow2 persistent bitmap *NAME*, expose
+  that bitmap via the ``qemu:dirty-bitmap:NAME`` context
+  accessible through NBD_OPT_SET_META_CONTEXT.
+
+.. option:: -s, --snapshot
+
+  Use *filename* as an external snapshot, create a temporary
+  file with ``backing_file=3D``\ *filename*, redirect the write to
+  the temporary one.
+
+.. option:: -l, --load-snapshot=3DSNAPSHOT_PARAM
+
+  Load an internal snapshot inside *filename* and export it
+  as an read-only device, SNAPSHOT_PARAM format is
+  ``snapshot.id=3D[ID],snapshot.name=3D[NAME]`` or ``[ID_OR_NAME]``
+
+.. option:: --cache=3DCACHE
+
+  The cache mode to be used with the file.  See the documentation of
+  the emulator's ``-drive cache=3D...`` option for allowed values.
+
+.. option:: -n, --nocache
+
+  Equivalent to :option:`--cache=3Dnone`.
+
+.. option:: --aio=3DAIO
+
+  Set the asynchronous I/O mode between ``threads`` (the default)
+  and ``native`` (Linux only).
+
+.. option:: --discard=3DDISCARD
+
+  Control whether ``discard`` (also known as ``trim`` or ``unmap``)
+  requests are ignored or passed to the filesystem. *DISCARD* is one of
+  ``ignore`` (or ``off``), ``unmap`` (or ``on``).  The default is
+  ``ignore``.
+
+.. option:: --detect-zeroes=3DDETECT_ZEROES
+
+  Control the automatic conversion of plain zero writes by the OS to
+  driver-specific optimized zero write commands.  *DETECT_ZEROES* is one of
+  ``off``, ``on``, or ``unmap``.  ``unmap``
+  converts a zero write to an unmap operation and can only be used if
+  *DISCARD* is set to ``unmap``.  The default is ``off``.
+
+.. option:: -c, --connect=3DDEV
+
+  Connect *filename* to NBD device *DEV* (Linux only).
+
+.. option:: -d, --disconnect
+
+  Disconnect the device *DEV* (Linux only).
+
+.. option:: -e, --shared=3DNUM
+
+  Allow up to *NUM* clients to share the device (default
+  ``1``). Safe for readers, but for now, consistency is not
+  guaranteed between multiple writers.
+
+.. option:: -t, --persistent
+
+  Don't exit on the last connection.
+
+.. option:: -x, --export-name=3DNAME
+
+  Set the NBD volume export name (default of a zero-length string).
+
+.. option:: -D, --description=3DDESCRIPTION
+
+  Set the NBD volume export description, as a human-readable
+  string.
+
+.. option:: -L, --list
+
+  Connect as a client and list all details about the exports exposed by
+  a remote NBD server.  This enables list mode, and is incompatible
+  with options that change behavior related to a specific export (such as
+  :option:`--export-name`, :option:`--offset`, ...).
+
+.. option:: --tls-creds=3DID
+
+  Enable mandatory TLS encryption for the server by setting the ID
+  of the TLS credentials object previously created with the --object
+  option; or provide the credentials needed for connecting as a client
+  in list mode.
+
+.. option:: --fork
+
+  Fork off the server process and exit the parent once the server is runni=
ng.
+
+.. option:: --pid-file=3DPATH
+
+  Store the server's process ID in the given file.
+
+.. option:: --tls-authz=3DID
+
+  Specify the ID of a qauthz object previously created with the
+  :option:`--object` option. This will be used to authorize connecting use=
rs
+  against their x509 distinguished name.
+
+.. option:: -v, --verbose
+
+  Display extra debugging information.
+
+.. option:: -h, --help
+
+  Display this help and exit.
+
+.. option:: -V, --version
+
+  Display version information and exit.
+
+.. option:: -T, --trace [[enable=3D]PATTERN][,events=3DFILE][,file=3DFILE]
+
+  .. include:: qemu-option-trace.rst.inc
+
+Examples
+--------
+
+Start a server listening on port 10809 that exposes only the
+guest-visible contents of a qcow2 file, with no TLS encryption, and
+with the default export name (an empty string). The command is
+one-shot, and will block until the first successful client
+disconnects:
+
+::
+
+  qemu-nbd -f qcow2 file.qcow2
+
+Start a long-running server listening with encryption on port 10810,
+and whitelist clients with a specific X.509 certificate to connect to
+a 1 megabyte subset of a raw file, using the export name 'subset':
+
+::
+
+  qemu-nbd \
+    --object tls-creds-x509,id=3Dtls0,endpoint=3Dserver,dir=3D/path/to/qem=
utls \
+    --object 'authz-simple,id=3Dauth0,identity=3DCN=3Dlaptop.example.com,,\
+              O=3DExample Org,,L=3DLondon,,ST=3DLondon,,C=3DGB' \
+    --tls-creds tls0 --tls-authz auth0 \
+    -t -x subset -p 10810 \
+    --image-opts driver=3Draw,offset=3D1M,size=3D1M,file.driver=3Dfile,fil=
e.filename=3Dfile.raw
+
+Serve a read-only copy of just the first MBR partition of a guest
+image over a Unix socket with as many as 5 simultaneous readers, with
+a persistent process forked as a daemon:
+
+::
+
+  qemu-nbd --fork --persistent --shared=3D5 --socket=3D/path/to/sock \
+    --partition=3D1 --read-only --format=3Dqcow2 file.qcow2
+
+Expose the guest-visible contents of a qcow2 file via a block device
+/dev/nbd0 (and possibly creating /dev/nbd0p1 and friends for
+partitions found within), then disconnect the device when done.
+Access to bind qemu-nbd to an /dev/nbd device generally requires root
+privileges, and may also require the execution of ``modprobe nbd``
+to enable the kernel NBD client module.  *CAUTION*: Do not use
+this method to mount filesystems from an untrusted guest image - a
+malicious guest may have prepared the image to attempt to trigger
+kernel bugs in partition probing or file system mounting.
+
+::
+
+  qemu-nbd -c /dev/nbd0 -f qcow2 file.qcow2
+  qemu-nbd -d /dev/nbd0
+
+Query a remote server to see details about what export(s) it is
+serving on port 10809, and authenticating via PSK:
+
+::
+
+  qemu-nbd \
+    --object tls-creds-psk,id=3Dtls0,dir=3D/tmp/keys,username=3Deblake,end=
point=3Dclient \
+    --tls-creds tls0 -L -b remote.example.com
+
+See also
+--------
+
+:manpage:`qemu(1)`, :manpage:`qemu-img(1)`
diff --git a/docs/interop/qemu-option-trace.rst.inc b/docs/interop/qemu-opt=
ion-trace.rst.inc
new file mode 100644
index 00000000000..23cfcb48537
--- /dev/null
+++ b/docs/interop/qemu-option-trace.rst.inc
@@ -0,0 +1,30 @@
+..
+  The contents of this file must be kept in sync with qemu-option-trace.te=
xi
+  until all the users of the texi file have been converted to rst and
+  the texi file can be removed.
+
+Specify tracing options.
+
+.. option:: [enable=3D]PATTERN
+
+  Immediately enable events matching *PATTERN*
+  (either event name or a globbing pattern).  This option is only
+  available if QEMU has been compiled with the ``simple``, ``log``
+  or ``ftrace`` tracing backend.  To specify multiple events or patterns,
+  specify the :option:`-trace` option multiple times.
+
+  Use :option:`-trace help` to print a list of names of trace points.
+
+.. option:: events=3DFILE
+
+  Immediately enable events listed in *FILE*.
+  The file must contain one event name (as listed in the ``trace-events-al=
l``
+  file) per line; globbing patterns are accepted too.  This option is only
+  available if QEMU has been compiled with the ``simple``, ``log`` or
+  ``ftrace`` tracing backend.
+
+.. option:: file=3DFILE
+
+  Log output traces to *FILE*.
+  This option is only available if QEMU has been compiled with
+  the ``simple`` tracing backend.
diff --git a/qemu-doc.texi b/qemu-doc.texi
index 39f950471f2..617485d1461 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -633,7 +633,6 @@ encrypted disk images.
 * disk_images_snapshot_mode:: Snapshot mode
 * vm_snapshots::              VM snapshots
 * qemu_img_invocation::       qemu-img Invocation
-* qemu_nbd_invocation::       qemu-nbd Invocation
 * disk_images_formats::       Disk image file formats
 * host_drives::               Using host drives
 * disk_images_fat_images::    Virtual FAT disk images
@@ -724,11 +723,6 @@ state is not saved or restored properly (in particular=
 USB).
=20
 @include qemu-img.texi
=20
-@node qemu_nbd_invocation
-@subsection @code{qemu-nbd} Invocation
-
-@include qemu-nbd.texi
-
 @include docs/qemu-block-drivers.texi
=20
 @node pcsys_network
diff --git a/qemu-nbd.texi b/qemu-nbd.texi
deleted file mode 100644
index 7f55657722b..00000000000
--- a/qemu-nbd.texi
+++ /dev/null
@@ -1,214 +0,0 @@
-@example
-@c man begin SYNOPSIS
-@command{qemu-nbd} [OPTION]... @var{filename}
-
-@command{qemu-nbd} @option{-L} [OPTION]...
-
-@command{qemu-nbd} @option{-d} @var{dev}
-@c man end
-@end example
-
-@c man begin DESCRIPTION
-
-Export a QEMU disk image using the NBD protocol.
-
-Other uses:
-@itemize
-@item
-Bind a /dev/nbdX block device to a QEMU server (on Linux).
-@item
-As a client to query exports of a remote NBD server.
-@end itemize
-
-@c man end
-
-@c man begin OPTIONS
-@var{filename} is a disk image filename, or a set of block
-driver options if @option{--image-opts} is specified.
-
-@var{dev} is an NBD device.
-
-@table @option
-@item --object type,id=3D@var{id},...props...
-Define a new instance of the @var{type} object class identified by @var{id=
}.
-See the @code{qemu(1)} manual page for full details of the properties
-supported. The common object types that it makes sense to define are the
-@code{secret} object, which is used to supply passwords and/or encryption
-keys, and the @code{tls-creds} object, which is used to supply TLS
-credentials for the qemu-nbd server or client.
-@item -p, --port=3D@var{port}
-The TCP port to listen on as a server, or connect to as a client
-(default @samp{10809}).
-@item -o, --offset=3D@var{offset}
-The offset into the image.
-@item -b, --bind=3D@var{iface}
-The interface to bind to as a server, or connect to as a client
-(default @samp{0.0.0.0}).
-@item -k, --socket=3D@var{path}
-Use a unix socket with path @var{path}.
-@item --image-opts
-Treat @var{filename} as a set of image options, instead of a plain
-filename. If this flag is specified, the @var{-f} flag should
-not be used, instead the '@code{format=3D}' option should be set.
-@item -f, --format=3D@var{fmt}
-Force the use of the block driver for format @var{fmt} instead of
-auto-detecting.
-@item -r, --read-only
-Export the disk as read-only.
-@item -P, --partition=3D@var{num}
-Deprecated: Only expose MBR partition @var{num}.  Understands physical
-partitions 1-4 and logical partition 5. New code should instead use
-@option{--image-opts} with the raw driver wrapping a subset of the
-original image.
-@item -B, --bitmap=3D@var{name}
-If @var{filename} has a qcow2 persistent bitmap @var{name}, expose
-that bitmap via the ``qemu:dirty-bitmap:@var{name}'' context
-accessible through NBD_OPT_SET_META_CONTEXT.
-@item -s, --snapshot
-Use @var{filename} as an external snapshot, create a temporary
-file with backing_file=3D@var{filename}, redirect the write to
-the temporary one.
-@item -l, --load-snapshot=3D@var{snapshot_param}
-Load an internal snapshot inside @var{filename} and export it
-as an read-only device, @var{snapshot_param} format is
-'snapshot.id=3D[ID],snapshot.name=3D[NAME]' or '[ID_OR_NAME]'
-@item -n, --nocache
-@itemx --cache=3D@var{cache}
-The cache mode to be used with the file.  See the documentation of
-the emulator's @code{-drive cache=3D...} option for allowed values.
-@item --aio=3D@var{aio}
-Set the asynchronous I/O mode between @samp{threads} (the default)
-and @samp{native} (Linux only).
-@item --discard=3D@var{discard}
-Control whether @dfn{discard} (also known as @dfn{trim} or @dfn{unmap})
-requests are ignored or passed to the filesystem.  @var{discard} is one of
-@samp{ignore} (or @samp{off}), @samp{unmap} (or @samp{on}).  The default is
-@samp{ignore}.
-@item --detect-zeroes=3D@var{detect-zeroes}
-Control the automatic conversion of plain zero writes by the OS to
-driver-specific optimized zero write commands.  @var{detect-zeroes} is one=
 of
-@samp{off}, @samp{on} or @samp{unmap}.  @samp{unmap}
-converts a zero write to an unmap operation and can only be used if
-@var{discard} is set to @samp{unmap}.  The default is @samp{off}.
-@item -c, --connect=3D@var{dev}
-Connect @var{filename} to NBD device @var{dev} (Linux only).
-@item -d, --disconnect
-Disconnect the device @var{dev} (Linux only).
-@item -e, --shared=3D@var{num}
-Allow up to @var{num} clients to share the device (default
-@samp{1}). Safe for readers, but for now, consistency is not
-guaranteed between multiple writers.
-@item -t, --persistent
-Don't exit on the last connection.
-@item -x, --export-name=3D@var{name}
-Set the NBD volume export name (default of a zero-length string).
-@item -D, --description=3D@var{description}
-Set the NBD volume export description, as a human-readable
-string.
-@item -L, --list
-Connect as a client and list all details about the exports exposed by
-a remote NBD server.  This enables list mode, and is incompatible
-with options that change behavior related to a specific export (such as
-@option{--export-name}, @option{--offset}, ...).
-@item --tls-creds=3DID
-Enable mandatory TLS encryption for the server by setting the ID
-of the TLS credentials object previously created with the --object
-option; or provide the credentials needed for connecting as a client
-in list mode.
-@item --fork
-Fork off the server process and exit the parent once the server is running.
-@item --pid-file=3DPATH
-Store the server's process ID in the given file.
-@item --tls-authz=3DID
-Specify the ID of a qauthz object previously created with the
---object option. This will be used to authorize connecting users
-against their x509 distinguished name.
-@item -v, --verbose
-Display extra debugging information.
-@item -h, --help
-Display this help and exit.
-@item -V, --version
-Display version information and exit.
-@item -T, --trace [[enable=3D]@var{pattern}][,events=3D@var{file}][,file=
=3D@var{file}]
-@findex --trace
-@include qemu-option-trace.texi
-@end table
-
-@c man end
-
-@c man begin EXAMPLES
-Start a server listening on port 10809 that exposes only the
-guest-visible contents of a qcow2 file, with no TLS encryption, and
-with the default export name (an empty string). The command is
-one-shot, and will block until the first successful client
-disconnects:
-
-@example
-qemu-nbd -f qcow2 file.qcow2
-@end example
-
-Start a long-running server listening with encryption on port 10810,
-and whitelist clients with a specific X.509 certificate to connect to
-a 1 megabyte subset of a raw file, using the export name 'subset':
-
-@example
-qemu-nbd \
-  --object tls-creds-x509,id=3Dtls0,endpoint=3Dserver,dir=3D/path/to/qemut=
ls \
-  --object 'authz-simple,id=3Dauth0,identity=3DCN=3Dlaptop.example.com,,\
-            O=3DExample Org,,L=3DLondon,,ST=3DLondon,,C=3DGB' \
-  --tls-creds tls0 --tls-authz auth0 \
-  -t -x subset -p 10810 \
-  --image-opts driver=3Draw,offset=3D1M,size=3D1M,file.driver=3Dfile,file.=
filename=3Dfile.raw
-@end example
-
-Serve a read-only copy of just the first MBR partition of a guest
-image over a Unix socket with as many as 5 simultaneous readers, with
-a persistent process forked as a daemon:
-
-@example
-qemu-nbd --fork --persistent --shared=3D5 --socket=3D/path/to/sock \
-  --partition=3D1 --read-only --format=3Dqcow2 file.qcow2
-@end example
-
-Expose the guest-visible contents of a qcow2 file via a block device
-/dev/nbd0 (and possibly creating /dev/nbd0p1 and friends for
-partitions found within), then disconnect the device when done.
-Access to bind qemu-nbd to an /dev/nbd device generally requires root
-privileges, and may also require the execution of @code{modprobe nbd}
-to enable the kernel NBD client module.  @emph{CAUTION}: Do not use
-this method to mount filesystems from an untrusted guest image - a
-malicious guest may have prepared the image to attempt to trigger
-kernel bugs in partition probing or file system mounting.
-
-@example
-qemu-nbd -c /dev/nbd0 -f qcow2 file.qcow2
-qemu-nbd -d /dev/nbd0
-@end example
-
-Query a remote server to see details about what export(s) it is
-serving on port 10809, and authenticating via PSK:
-
-@example
-qemu-nbd \
-  --object tls-creds-psk,id=3Dtls0,dir=3D/tmp/keys,username=3Deblake,endpo=
int=3Dclient \
-  --tls-creds tls0 -L -b remote.example.com
-@end example
-
-@c man end
-
-@ignore
-
-@setfilename qemu-nbd
-@settitle QEMU Disk Network Block Device Server
-
-@c man begin AUTHOR
-Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>.
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-@c man end
-
-@c man begin SEEALSO
-qemu(1), qemu-img(1)
-@c man end
-
-@end ignore
diff --git a/qemu-option-trace.texi b/qemu-option-trace.texi
index 7d1b7f05c54..162f1528d21 100644
--- a/qemu-option-trace.texi
+++ b/qemu-option-trace.texi
@@ -1,3 +1,7 @@
+@c The contents of this file must be kept in sync with qemu-option-trace.r=
st.inc
+@c until all the users of the texi file have been converted to rst and
+@c the texi file can be removed.
+
 Specify tracing options.
=20
 @table @option
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579801449; cv=none;
	d=zohomail.com; s=zohoarc;
	b=QlYaBTcMkyiEqciy3Ueiil96h8b1sP1/2q+1kVQPS8MUGHUszCzQD/ex40MnFDB1VpJJ1Z9e8XaLaU/wEXv+qLPwg++YLVDCGP6IH7yftwB4z0RBmRSLGrzppLBwxU3TD1a+FbNqEwrL8rrfWbGBUON7j+4dcS0nwC0S6qxa85Y=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579801449;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=pwJvuoYj5XQgcYzCmAadQQKwmUSyeHP8Y+GhQZSCMJc=;
	b=fXsfAUAbTPypRQddFYkggFZl685cOvr0sIy57ItJIPZONgQGa+7JXj95Z9otslFgvgOCXUXQfXij68BGnNKe+KLl298+NBkB7rXCiHr7Sjy+QuXGin/tW3cyMam2NSNbs9QgBaBzAeACAVaNFIWSdD6xmazz5WBrFWIalhr75yI=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579801449451493.52475949426616;
 Thu, 23 Jan 2020 09:44:09 -0800 (PST)
Received: from localhost ([::1]:33858 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugWV-00055N-IO
	for importer@patchew.org; Thu, 23 Jan 2020 12:44:07 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48372)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRb-0000Hx-AC
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:56 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRZ-0003iN-OZ
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:55 -0500
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:36368)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRZ-0003ht-HZ
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:53 -0500
Received: by mail-wr1-x432.google.com with SMTP id z3so3564546wru.3
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:53 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.51
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=pwJvuoYj5XQgcYzCmAadQQKwmUSyeHP8Y+GhQZSCMJc=;
 b=X7YzdQXt8Ycy5cal2fosnzgWxHIO2uYbo9hGlx7XUQo3ChWOfxOwsd+wXXEyK/K2ZQ
 toAU/CgcuXpdaXBjBm0qRCX7DxUpn4RpZ8rq2pbuwgfdalwvf+asdEkaJZlj5r2A0BPT
 UQrUK382WgeTSAoaccjkl0BINOdaLbPRHYTtrdAV6ZiPrALi+YH6rQ/z5vWTJHRQ8hER
 BveqBtW7eT/0t+z7VPfKSvWTyYjVYrYlHmppMdNmww5fy+ofTjZ7cUaQm5mlKbk9zObo
 vsmDFkb0O7uF6iMSLmWDSVpAK4jncf7z82kBWOeul9iK27vBvTp3bPrFHlR84z80mW8f
 HLvQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=pwJvuoYj5XQgcYzCmAadQQKwmUSyeHP8Y+GhQZSCMJc=;
 b=RuM5aQaF4lY7AaQ9zgKHg9fLUcyZhnA49UmA274/7x403KKblWg68hIMBqmVwU/VBj
 sO2bcDYcmVRAiCLq9qWy0uHqMT15S3equzklVHzVfvTaY6ZtgXCrUwHwmPIzDEuzjXk0
 1eNFwym3yupucxnW8lYL5PvcbxsOTGaL44lwiluAyOTAU9/3RDoC35V4eUOL6V7l8Wku
 kNlg6syJ+gIA1J5MRrl8U1yaREQNVFg1kTZoJsKVoO6MqNzmsdTJbJC3PRbPJDI2XDnC
 QNLqjDbJMlOQtH/b/oKmrHnV4uQdlaZR78HAFIfp+dPYLmMEdKB/R9G7MrMENo4W3GmC
 BNEA==
X-Gm-Message-State: APjAAAXhbORZ8LuFfYN6wozF8YIq8G8/LP5tk3r+3IorGPSPAGgPrBJ1
 DQzLSn19O/xmzHTRlyIY9CNrUxhKjxpe8Q==
X-Google-Smtp-Source: 
 APXvYqyMsI9BQJIdNPUQtwuTOtBbVo+g4Su6VB4NvwoyBH/iIeeKBXOpRGHz28M53MOd1CsdJ6uM7w==
X-Received: by 2002:adf:f382:: with SMTP id m2mr18020626wro.163.1579793452393;
 Thu, 23 Jan 2020 07:30:52 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 09/20] docs: Create stub system manual
Date: Thu, 23 Jan 2020 15:30:30 +0000
Message-Id: <20200123153041.4248-10-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::432
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

We want a user-facing manual which contains system emulation
documentation. Create an empty one which we can populate.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20200116141511.16849-3-peter.maydell@linaro.org
---
 Makefile              | 10 +++++++++-
 docs/index.html.in    |  1 +
 docs/system/conf.py   | 15 +++++++++++++++
 docs/system/index.rst | 16 ++++++++++++++++
 4 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 docs/system/conf.py
 create mode 100644 docs/system/index.rst

diff --git a/Makefile b/Makefile
index b4a6c28107d..2ab6a17205f 100644
--- a/Makefile
+++ b/Makefile
@@ -757,6 +757,7 @@ distclean: clean
 	$(call clean-manual,devel)
 	$(call clean-manual,interop)
 	$(call clean-manual,specs)
+	$(call clean-manual,system)
 	for d in $(TARGET_DIRS); do \
 	rm -rf $$d || exit 1 ; \
         done
@@ -813,6 +814,7 @@ endef
 install-sphinxdocs: sphinxdocs
 	$(call install-manual,interop)
 	$(call install-manual,specs)
+	$(call install-manual,system)
=20
 install-doc: $(DOCS) install-sphinxdocs
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_docdir)"
@@ -1000,7 +1002,10 @@ docs/version.texi: $(SRC_PATH)/VERSION config-host.m=
ak
 # and handles "don't rebuild things unless necessary" itself.
 # The '.doctrees' files are cached information to speed this up.
 .PHONY: sphinxdocs
-sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html $(MANUAL_BUILDDIR)/interop=
/index.html $(MANUAL_BUILDDIR)/specs/index.html
+sphinxdocs: $(MANUAL_BUILDDIR)/devel/index.html \
+            $(MANUAL_BUILDDIR)/interop/index.html \
+            $(MANUAL_BUILDDIR)/specs/index.html \
+            $(MANUAL_BUILDDIR)/system/index.html
=20
 # Canned command to build a single manual
 # Arguments: $1 =3D manual name, $2 =3D Sphinx builder ('html' or 'man')
@@ -1022,6 +1027,9 @@ $(MANUAL_BUILDDIR)/interop/index.html: $(call manual-=
deps,interop)
 $(MANUAL_BUILDDIR)/specs/index.html: $(call manual-deps,specs)
 	$(call build-manual,specs,html)
=20
+$(MANUAL_BUILDDIR)/system/index.html: $(call manual-deps,system)
+	$(call build-manual,system,html)
+
 $(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-deps,interop)
 	$(call build-manual,interop,man)
=20
diff --git a/docs/index.html.in b/docs/index.html.in
index 94eb782cf7e..8512933d145 100644
--- a/docs/index.html.in
+++ b/docs/index.html.in
@@ -12,6 +12,7 @@
             <li><a href=3D"qemu-ga-ref.html">Guest Agent Protocol Referenc=
e</a></li>
             <li><a href=3D"interop/index.html">System Emulation Management=
 and Interoperability Guide</a></li>
             <li><a href=3D"specs/index.html">System Emulation Guest Hardwa=
re Specifications</a></li>
+            <li><a href=3D"system/index.html">System Emulation User's Guid=
e</a></li>
         </ul>
     </body>
 </html>
diff --git a/docs/system/conf.py b/docs/system/conf.py
new file mode 100644
index 00000000000..6435b4d3f8e
--- /dev/null
+++ b/docs/system/conf.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+#
+# QEMU documentation build configuration file for the 'system' manual.
+#
+# This includes the top level conf file and then makes any necessary tweak=
s.
+import sys
+import os
+
+qemu_docdir =3D os.path.abspath("..")
+parent_config =3D os.path.join(qemu_docdir, "conf.py")
+exec(compile(open(parent_config, "rb").read(), parent_config, 'exec'))
+
+# This slightly misuses the 'description', but is the best way to get
+# the manual title to appear in the sidebar.
+html_theme_options['description'] =3D u'System Emulation User''s Guide'
diff --git a/docs/system/index.rst b/docs/system/index.rst
new file mode 100644
index 00000000000..ea8ea5fe3dc
--- /dev/null
+++ b/docs/system/index.rst
@@ -0,0 +1,16 @@
+.. This is the top level page for the 'system' manual.
+
+
+QEMU System Emulation User's Guide
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
+
+This manual is the overall guide for users using QEMU
+for full system emulation (as opposed to user-mode emulation).
+This includes working with hypervisors such as KVM, Xen, Hax
+or Hypervisor.Framework.
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579802415; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ZtdEvopSDnvxCbcj1quFX6L4nzibnZFqHRSjFG3xh49CMcsZjIiA3o7U/MKSXkkSgzT7W/Hila4rpA8pXY/021MIP1FfoowQIRt6cZ/1CCnzzmNPBQv1PRHHhJTOY0CrRadCgbPonTOE9HnoCVDbuBH/ft1qvYANTDfbfuNVE5A=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579802415;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=zMlHNoRwh4yPNnOGjj4od/YG3+AUapjjoEKQXA71MrI=;
	b=BYCI7hevxFMhCPqV23VQJJzBb/HWaYCSdZCYh7BfZczIuNOIla/rK9PO7Szs8eMc34VgVmVxofiArXe4n1YT+8z4EfpTuDTNfNpQgBc+Ru78T94uXbxPDxWbe54pwwfn1SQynHOKp0aqFFn2H0HQdeWJuubChGkTWuv5sRSjeEY=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579802415636943.1429931242634;
 Thu, 23 Jan 2020 10:00:15 -0800 (PST)
Received: from localhost ([::1]:34142 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugm5-0000kL-R0
	for importer@patchew.org; Thu, 23 Jan 2020 13:00:13 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48512)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRo-0000WA-KP
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:17 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRe-0003pl-UC
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:08 -0500
Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:35659)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRe-0003nC-E3
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:58 -0500
Received: by mail-wm1-x341.google.com with SMTP id p17so2998996wmb.0
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:58 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.52
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=zMlHNoRwh4yPNnOGjj4od/YG3+AUapjjoEKQXA71MrI=;
 b=SuOWTaZkdzDhEI1AImn5Bt0P6c8Iw6mCoUgMN3qHF12y0I8QkSxkG1NJSZoYaEbuQT
 TZ0wfAJUcdizd39PWlzjqWm7D5V6iY4kVV0fWh6KC2igRH4sZSzi0mLmqU93gPzT0Qsi
 04lfjUf8eWAl31ncL7OHxaJ7vXtDuRzgq8GEA3Er1TZ9xjgsCjJt7vdYbA6qyn8m3aRr
 pSuI+haZ52LnwacJgXmtgY/SqbqQkgYk83fBjIq1iZGzc3QCjKdPgJFYstXLSlFQvOeS
 Ghma6RBRSZvaTr0qap/IeWxcxDg+6XR9gpm7Rgdo3PmefSRElM2lX/ExcYYtV5aAiuXI
 Cg5w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=zMlHNoRwh4yPNnOGjj4od/YG3+AUapjjoEKQXA71MrI=;
 b=EsugdxJISUhOqpS3vX9SBLZtuA3FkB+A6ggCA8jZJv8mDv7sg6cI3SD9kLj7JlxmR8
 PzPegKCTMkxI6ubdSpfx/16yvs8XxxZl1CmAaRr4CkkP40XFziBkvFDPRij124LmclFu
 XwYuU75tFgJAK0M62EZ4azkCLyfrd9UGzr8+0NKpt8tZFIRlMx/JCZV4m7XpWMu7oN5F
 wcfGVghK+YF4Jk6cItMyd4I7rFPI6KH8w/Xj9nyvnjBHTXXMK4dkRchx3loo41mrYENa
 T0U63Ag6gwDPB7Phip87EBCfJqwkhlIsTJAUvMAQMBZ55wI4gSxR3prU6yXrP9w+lxd7
 +OuA==
X-Gm-Message-State: APjAAAV4l4tRmVLOax0wb5Aq5ZfaCqhyxSTd96H3ZNXh2EDNpC7iwAxx
 RSbxbg2As9iGGDaCmTW/gsUkHkyDZbA6aQ==
X-Google-Smtp-Source: 
 APXvYqx25CvZeRqvlfLxE1jFZ19WEzMGmI1C63FELLEMsSXPLLDOSQuW683Na07R72677SI5RWQfcg==
X-Received: by 2002:a1c:7718:: with SMTP id t24mr4015537wmi.119.1579793454645;
 Thu, 23 Jan 2020 07:30:54 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 10/20] qemu-block-drivers: Convert to rST
Date: Thu, 23 Jan 2020 15:30:31 +0000
Message-Id: <20200123153041.4248-11-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::341
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

The qemu-block-drivers documentation is currently in
docs/qemu-block-drivers.texi in Texinfo format, which we present
to the user as:
 * a qemu-block-drivers manpage
 * a section of the main qemu-doc HTML documentation

Convert the documentation to rST format, and present it to
the user as:
 * a qemu-block-drivers manpage
 * part of the system/ Sphinx manual

This follows the same pattern we've done for qemu-ga and qemu-nbd.

We have to drop a cross-reference from the documentation of the
-cdrom option back to the qemu-block-drivers documentation, since
they're no longer within the same texinfo document.

As noted in a comment, the manpage output is slightly compromised
due to limitations in Sphinx. In an ideal world, the HTML output
would have the various headings like 'Disk image file formats'
as top-level section headings (which then appear in the overall
system manual's table-of-contents), and it would not have the
section headings which make sense only for the manpage like
'synopsis', 'description', and 'see also'. Unfortunately, the
mechanism Sphinx provides for restricting pieces of documentation
is limited to the point of being flawed: the 'only::' directive
is implemented as a filter that is applied at a very late stage
in the document processing pipeline, rather than as an early
equivalent of an #ifdef. This means that Sphinx's process of
identifying which section heading markup styles are which levels
of heading gets confused if the 'only::' directive contains
section headings which would affect the heading-level of a
later heading. I have opted to prioritise making the HTML format
look better, with the compromise being that in the manpage
the 'Disk image file formats' &c headings are top-level headings
rather than being sub-headings under the traditional 'Description'
top-level section title.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Tested-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20200116141511.16849-4-peter.maydell@linaro.org
---
 Makefile                           |  11 +-
 docs/qemu-block-drivers.texi       | 889 --------------------------
 docs/system/conf.py                |   7 +
 docs/system/index.rst              |   1 +
 docs/system/qemu-block-drivers.rst | 985 +++++++++++++++++++++++++++++
 qemu-doc.texi                      |  12 -
 qemu-options.hx                    |   2 +-
 7 files changed, 1000 insertions(+), 907 deletions(-)
 delete mode 100644 docs/qemu-block-drivers.texi
 create mode 100644 docs/system/qemu-block-drivers.rst

diff --git a/Makefile b/Makefile
index 2ab6a17205f..9473509112a 100644
--- a/Makefile
+++ b/Makefile
@@ -342,9 +342,9 @@ ifdef BUILD_DOCS
 DOCS=3Dqemu-doc.html qemu-doc.txt qemu.1 qemu-img.1
 DOCS+=3D$(MANUAL_BUILDDIR)/interop/qemu-nbd.8
 DOCS+=3D$(MANUAL_BUILDDIR)/interop/qemu-ga.8
+DOCS+=3D$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7
 DOCS+=3Ddocs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/=
interop/qemu-qmp-ref.7
 DOCS+=3Ddocs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/in=
terop/qemu-ga-ref.7
-DOCS+=3Ddocs/qemu-block-drivers.7
 DOCS+=3Ddocs/qemu-cpu-models.7
 DOCS+=3D$(MANUAL_BUILDDIR)/index.html
 ifdef CONFIG_VIRTFS
@@ -751,7 +751,6 @@ distclean: clean
 	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
 	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
 	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
-	rm -f docs/qemu-block-drivers.7
 	rm -f docs/qemu-cpu-models.7
 	rm -rf .doctrees
 	$(call clean-manual,devel)
@@ -828,7 +827,7 @@ ifdef CONFIG_POSIX
 	$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
 	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
-	$(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
+	$(INSTALL_DATA) $(MANUAL_BUILDDIR)/system/qemu-block-drivers.7 "$(DESTDIR=
)$(mandir)/man7"
 	$(INSTALL_DATA) docs/qemu-cpu-models.7 "$(DESTDIR)$(mandir)/man7"
 ifeq ($(CONFIG_TOOLS),y)
 	$(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
@@ -1036,6 +1035,9 @@ $(MANUAL_BUILDDIR)/interop/qemu-ga.8: $(call manual-d=
eps,interop)
 $(MANUAL_BUILDDIR)/interop/qemu-nbd.8: $(call manual-deps,interop)
 	$(call build-manual,interop,man)
=20
+$(MANUAL_BUILDDIR)/system/qemu-block-drivers.7: $(call manual-deps,system)
+	$(call build-manual,system,man)
+
 $(MANUAL_BUILDDIR)/index.html: $(SRC_PATH)/docs/index.html.in qemu-version=
.h
 	@mkdir -p "$(MANUAL_BUILDDIR)"
 	$(call quiet-command, sed "s|@@VERSION@@|${VERSION}|g" $< >$@, \
@@ -1063,7 +1065,6 @@ qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.=
texi qemu-monitor-info.texi
 qemu.1: qemu-option-trace.texi
 qemu-img.1: qemu-img.texi qemu-option-trace.texi qemu-img-cmds.texi
 fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
-docs/qemu-block-drivers.7: docs/qemu-block-drivers.texi
 docs/qemu-cpu-models.7: docs/qemu-cpu-models.texi
 scripts/qemu-trace-stap.1: scripts/qemu-trace-stap.texi
=20
@@ -1076,7 +1077,7 @@ qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt=
: \
 	qemu-img.texi qemu-options.texi \
 	qemu-tech.texi qemu-option-trace.texi \
 	qemu-deprecated.texi qemu-monitor.texi qemu-img-cmds.texi \
-	qemu-monitor-info.texi docs/qemu-block-drivers.texi \
+	qemu-monitor-info.texi \
 	docs/qemu-cpu-models.texi docs/security.texi
=20
 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
diff --git a/docs/qemu-block-drivers.texi b/docs/qemu-block-drivers.texi
deleted file mode 100644
index 2c7ea49c32d..00000000000
--- a/docs/qemu-block-drivers.texi
+++ /dev/null
@@ -1,889 +0,0 @@
-@c man begin SYNOPSIS
-QEMU block driver reference manual
-@c man end
-
-@set qemu_system qemu-system-x86_64
-
-@c man begin DESCRIPTION
-
-@node disk_images_formats
-@subsection Disk image file formats
-
-QEMU supports many image file formats that can be used with VMs as well as=
 with
-any of the tools (like @code{qemu-img}). This includes the preferred forma=
ts
-raw and qcow2 as well as formats that are supported for compatibility with
-older QEMU versions or other hypervisors.
-
-Depending on the image format, different options can be passed to
-@code{qemu-img create} and @code{qemu-img convert} using the @code{-o} opt=
ion.
-This section describes each format and the options that are supported for =
it.
-
-@table @option
-@item raw
-
-Raw disk image format. This format has the advantage of
-being simple and easily exportable to all other emulators. If your
-file system supports @emph{holes} (for example in ext2 or ext3 on
-Linux or NTFS on Windows), then only the written sectors will reserve
-space. Use @code{qemu-img info} to know the real size used by the
-image or @code{ls -ls} on Unix/Linux.
-
-Supported options:
-@table @code
-@item preallocation
-Preallocation mode (allowed values: @code{off}, @code{falloc}, @code{full}=
).
-@code{falloc} mode preallocates space for image by calling posix_fallocate=
().
-@code{full} mode preallocates space for image by writing data to underlying
-storage.  This data may or may not be zero, depending on the storage locat=
ion.
-@end table
-
-@item qcow2
-QEMU image format, the most versatile format. Use it to have smaller
-images (useful if your filesystem does not supports holes, for example
-on Windows), zlib based compression and support of multiple VM
-snapshots.
-
-Supported options:
-@table @code
-@item compat
-Determines the qcow2 version to use. @code{compat=3D0.10} uses the
-traditional image format that can be read by any QEMU since 0.10.
-@code{compat=3D1.1} enables image format extensions that only QEMU 1.1 and
-newer understand (this is the default). Amongst others, this includes
-zero clusters, which allow efficient copy-on-read for sparse images.
-
-@item backing_file
-File name of a base image (see @option{create} subcommand)
-@item backing_fmt
-Image format of the base image
-@item encryption
-This option is deprecated and equivalent to @code{encrypt.format=3Daes}
-
-@item encrypt.format
-
-If this is set to @code{luks}, it requests that the qcow2 payload (not
-qcow2 header) be encrypted using the LUKS format. The passphrase to
-use to unlock the LUKS key slot is given by the @code{encrypt.key-secret}
-parameter. LUKS encryption parameters can be tuned with the other
-@code{encrypt.*} parameters.
-
-If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
-The encryption key is given by the @code{encrypt.key-secret} parameter.
-This encryption format is considered to be flawed by modern cryptography
-standards, suffering from a number of design problems:
-
-@itemize @minus
-@item The AES-CBC cipher is used with predictable initialization vectors b=
ased
-on the sector number. This makes it vulnerable to chosen plaintext attacks
-which can reveal the existence of encrypted data.
-@item The user passphrase is directly used as the encryption key. A poorly
-chosen or short passphrase will compromise the security of the encryption.
-@item In the event of the passphrase being compromised there is no way to
-change the passphrase to protect data in any qcow images. The files must
-be cloned, using a different encryption passphrase in the new file. The
-original file must then be securely erased using a program like shred,
-though even this is ineffective with many modern storage technologies.
-@end itemize
-
-The use of this is no longer supported in system emulators. Support only
-remains in the command line utilities, for the purposes of data liberation
-and interoperability with old versions of QEMU. The @code{luks} format
-should be used instead.
-
-@item encrypt.key-secret
-
-Provides the ID of a @code{secret} object that contains the passphrase
-(@code{encrypt.format=3Dluks}) or encryption key (@code{encrypt.format=3Da=
es}).
-
-@item encrypt.cipher-alg
-
-Name of the cipher algorithm and key length. Currently defaults
-to @code{aes-256}. Only used when @code{encrypt.format=3Dluks}.
-
-@item encrypt.cipher-mode
-
-Name of the encryption mode to use. Currently defaults to @code{xts}.
-Only used when @code{encrypt.format=3Dluks}.
-
-@item encrypt.ivgen-alg
-
-Name of the initialization vector generator algorithm. Currently defaults
-to @code{plain64}. Only used when @code{encrypt.format=3Dluks}.
-
-@item encrypt.ivgen-hash-alg
-
-Name of the hash algorithm to use with the initialization vector generator
-(if required). Defaults to @code{sha256}. Only used when @code{encrypt.for=
mat=3Dluks}.
-
-@item encrypt.hash-alg
-
-Name of the hash algorithm to use for PBKDF algorithm
-Defaults to @code{sha256}. Only used when @code{encrypt.format=3Dluks}.
-
-@item encrypt.iter-time
-
-Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
-Defaults to @code{2000}. Only used when @code{encrypt.format=3Dluks}.
-
-@item cluster_size
-Changes the qcow2 cluster size (must be between 512 and 2M). Smaller clust=
er
-sizes can improve the image file size whereas larger cluster sizes general=
ly
-provide better performance.
-
-@item preallocation
-Preallocation mode (allowed values: @code{off}, @code{metadata}, @code{fal=
loc},
-@code{full}). An image with preallocated metadata is initially larger but =
can
-improve performance when the image needs to grow. @code{falloc} and @code{=
full}
-preallocations are like the same options of @code{raw} format, but sets up
-metadata also.
-
-@item lazy_refcounts
-If this option is set to @code{on}, reference count updates are postponed =
with
-the goal of avoiding metadata I/O and improving performance. This is
-particularly interesting with @option{cache=3Dwritethrough} which doesn't =
batch
-metadata updates. The tradeoff is that after a host crash, the reference c=
ount
-tables must be rebuilt, i.e. on the next open an (automatic) @code{qemu-img
-check -r all} is required, which may take some time.
-
-This option can only be enabled if @code{compat=3D1.1} is specified.
-
-@item nocow
-If this option is set to @code{on}, it will turn off COW of the file. It's=
 only
-valid on btrfs, no effect on other file systems.
-
-Btrfs has low performance when hosting a VM image file, even more when the=
 guest
-on the VM also using btrfs as file system. Turning off COW is a way to mit=
igate
-this bad performance. Generally there are two ways to turn off COW on btrf=
s:
-a) Disable it by mounting with nodatacow, then all newly created files wil=
l be
-NOCOW. b) For an empty file, add the NOCOW file attribute. That's what thi=
s option
-does.
-
-Note: this option is only valid to new or empty files. If there is an exis=
ting
-file which is COW and has data blocks already, it couldn't be changed to N=
OCOW
-by setting @code{nocow=3Don}. One can issue @code{lsattr filename} to chec=
k if
-the NOCOW flag is set or not (Capital 'C' is NOCOW flag).
-
-@end table
-
-@item qed
-Old QEMU image format with support for backing files and compact image fil=
es
-(when your filesystem or transport medium does not support holes).
-
-When converting QED images to qcow2, you might want to consider using the
-@code{lazy_refcounts=3Don} option to get a more QED-like behaviour.
-
-Supported options:
-@table @code
-@item backing_file
-File name of a base image (see @option{create} subcommand).
-@item backing_fmt
-Image file format of backing file (optional).  Useful if the format cannot=
 be
-autodetected because it has no header, like some vhd/vpc files.
-@item cluster_size
-Changes the cluster size (must be power-of-2 between 4K and 64K). Smaller
-cluster sizes can improve the image file size whereas larger cluster sizes
-generally provide better performance.
-@item table_size
-Changes the number of clusters per L1/L2 table (must be power-of-2 between=
 1
-and 16).  There is normally no need to change this value but this option c=
an be
-used for performance benchmarking.
-@end table
-
-@item qcow
-Old QEMU image format with support for backing files, compact image files,
-encryption and compression.
-
-Supported options:
-@table @code
-@item backing_file
-File name of a base image (see @option{create} subcommand)
-@item encryption
-This option is deprecated and equivalent to @code{encrypt.format=3Daes}
-
-@item encrypt.format
-If this is set to @code{aes}, the image is encrypted with 128-bit AES-CBC.
-The encryption key is given by the @code{encrypt.key-secret} parameter.
-This encryption format is considered to be flawed by modern cryptography
-standards, suffering from a number of design problems enumerated previously
-against the @code{qcow2} image format.
-
-The use of this is no longer supported in system emulators. Support only
-remains in the command line utilities, for the purposes of data liberation
-and interoperability with old versions of QEMU.
-
-Users requiring native encryption should use the @code{qcow2} format
-instead with @code{encrypt.format=3Dluks}.
-
-@item encrypt.key-secret
-
-Provides the ID of a @code{secret} object that contains the encryption
-key (@code{encrypt.format=3Daes}).
-
-@end table
-
-@item luks
-
-LUKS v1 encryption format, compatible with Linux dm-crypt/cryptsetup
-
-Supported options:
-@table @code
-
-@item key-secret
-
-Provides the ID of a @code{secret} object that contains the passphrase.
-
-@item cipher-alg
-
-Name of the cipher algorithm and key length. Currently defaults
-to @code{aes-256}.
-
-@item cipher-mode
-
-Name of the encryption mode to use. Currently defaults to @code{xts}.
-
-@item ivgen-alg
-
-Name of the initialization vector generator algorithm. Currently defaults
-to @code{plain64}.
-
-@item ivgen-hash-alg
-
-Name of the hash algorithm to use with the initialization vector generator
-(if required). Defaults to @code{sha256}.
-
-@item hash-alg
-
-Name of the hash algorithm to use for PBKDF algorithm
-Defaults to @code{sha256}.
-
-@item iter-time
-
-Amount of time, in milliseconds, to use for PBKDF algorithm per key slot.
-Defaults to @code{2000}.
-
-@end table
-
-@item vdi
-VirtualBox 1.1 compatible image format.
-Supported options:
-@table @code
-@item static
-If this option is set to @code{on}, the image is created with metadata
-preallocation.
-@end table
-
-@item vmdk
-VMware 3 and 4 compatible image format.
-
-Supported options:
-@table @code
-@item backing_file
-File name of a base image (see @option{create} subcommand).
-@item compat6
-Create a VMDK version 6 image (instead of version 4)
-@item hwversion
-Specify vmdk virtual hardware version. Compat6 flag cannot be enabled
-if hwversion is specified.
-@item subformat
-Specifies which VMDK subformat to use. Valid options are
-@code{monolithicSparse} (default),
-@code{monolithicFlat},
-@code{twoGbMaxExtentSparse},
-@code{twoGbMaxExtentFlat} and
-@code{streamOptimized}.
-@end table
-
-@item vpc
-VirtualPC compatible image format (VHD).
-Supported options:
-@table @code
-@item subformat
-Specifies which VHD subformat to use. Valid options are
-@code{dynamic} (default) and @code{fixed}.
-@end table
-
-@item VHDX
-Hyper-V compatible image format (VHDX).
-Supported options:
-@table @code
-@item subformat
-Specifies which VHDX subformat to use. Valid options are
-@code{dynamic} (default) and @code{fixed}.
-@item block_state_zero
-Force use of payload blocks of type 'ZERO'.  Can be set to @code{on} (defa=
ult)
-or @code{off}.  When set to @code{off}, new blocks will be created as
-@code{PAYLOAD_BLOCK_NOT_PRESENT}, which means parsers are free to return
-arbitrary data for those blocks.  Do not set to @code{off} when using
-@code{qemu-img convert} with @code{subformat=3Ddynamic}.
-@item block_size
-Block size; min 1 MB, max 256 MB.  0 means auto-calculate based on image s=
ize.
-@item log_size
-Log size; min 1 MB.
-@end table
-@end table
-
-@subsubsection Read-only formats
-More disk image file formats are supported in a read-only mode.
-@table @option
-@item bochs
-Bochs images of @code{growing} type.
-@item cloop
-Linux Compressed Loop image, useful only to reuse directly compressed
-CD-ROM images present for example in the Knoppix CD-ROMs.
-@item dmg
-Apple disk image.
-@item parallels
-Parallels disk image format.
-@end table
-
-
-@node host_drives
-@subsection Using host drives
-
-In addition to disk image files, QEMU can directly access host
-devices. We describe here the usage for QEMU version >=3D 0.8.3.
-
-@subsubsection Linux
-
-On Linux, you can directly use the host device filename instead of a
-disk image filename provided you have enough privileges to access
-it. For example, use @file{/dev/cdrom} to access to the CDROM.
-
-@table @code
-@item CD
-You can specify a CDROM device even if no CDROM is loaded. QEMU has
-specific code to detect CDROM insertion or removal. CDROM ejection by
-the guest OS is supported. Currently only data CDs are supported.
-@item Floppy
-You can specify a floppy device even if no floppy is loaded. Floppy
-removal is currently not detected accurately (if you change floppy
-without doing floppy access while the floppy is not loaded, the guest
-OS will think that the same floppy is loaded).
-Use of the host's floppy device is deprecated, and support for it will
-be removed in a future release.
-@item Hard disks
-Hard disks can be used. Normally you must specify the whole disk
-(@file{/dev/hdb} instead of @file{/dev/hdb1}) so that the guest OS can
-see it as a partitioned disk. WARNING: unless you know what you do, it
-is better to only make READ-ONLY accesses to the hard disk otherwise
-you may corrupt your host data (use the @option{-snapshot} command
-line option or modify the device permissions accordingly).
-@end table
-
-@subsubsection Windows
-
-@table @code
-@item CD
-The preferred syntax is the drive letter (e.g. @file{d:}). The
-alternate syntax @file{\\.\d:} is supported. @file{/dev/cdrom} is
-supported as an alias to the first CDROM drive.
-
-Currently there is no specific code to handle removable media, so it
-is better to use the @code{change} or @code{eject} monitor commands to
-change or eject media.
-@item Hard disks
-Hard disks can be used with the syntax: @file{\\.\PhysicalDrive@var{N}}
-where @var{N} is the drive number (0 is the first hard disk).
-
-WARNING: unless you know what you do, it is better to only make
-READ-ONLY accesses to the hard disk otherwise you may corrupt your
-host data (use the @option{-snapshot} command line so that the
-modifications are written in a temporary file).
-@end table
-
-
-@subsubsection Mac OS X
-
-@file{/dev/cdrom} is an alias to the first CDROM.
-
-Currently there is no specific code to handle removable media, so it
-is better to use the @code{change} or @code{eject} monitor commands to
-change or eject media.
-
-@node disk_images_fat_images
-@subsection Virtual FAT disk images
-
-QEMU can automatically create a virtual FAT disk image from a
-directory tree. In order to use it, just type:
-
-@example
-@value{qemu_system} linux.img -hdb fat:/my_directory
-@end example
-
-Then you access access to all the files in the @file{/my_directory}
-directory without having to copy them in a disk image or to export
-them via SAMBA or NFS. The default access is @emph{read-only}.
-
-Floppies can be emulated with the @code{:floppy:} option:
-
-@example
-@value{qemu_system} linux.img -fda fat:floppy:/my_directory
-@end example
-
-A read/write support is available for testing (beta stage) with the
-@code{:rw:} option:
-
-@example
-@value{qemu_system} linux.img -fda fat:floppy:rw:/my_directory
-@end example
-
-What you should @emph{never} do:
-@itemize
-@item use non-ASCII filenames ;
-@item use "-snapshot" together with ":rw:" ;
-@item expect it to work when loadvm'ing ;
-@item write to the FAT directory on the host system while accessing it wit=
h the guest system.
-@end itemize
-
-@node disk_images_nbd
-@subsection NBD access
-
-QEMU can access directly to block device exported using the Network Block =
Device
-protocol.
-
-@example
-@value{qemu_system} linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
-@end example
-
-If the NBD server is located on the same host, you can use an unix socket =
instead
-of an inet socket:
-
-@example
-@value{qemu_system} linux.img -hdb nbd+unix://?socket=3D/tmp/my_socket
-@end example
-
-In this case, the block device must be exported using qemu-nbd:
-
-@example
-qemu-nbd --socket=3D/tmp/my_socket my_disk.qcow2
-@end example
-
-The use of qemu-nbd allows sharing of a disk between several guests:
-@example
-qemu-nbd --socket=3D/tmp/my_socket --share=3D2 my_disk.qcow2
-@end example
-
-@noindent
-and then you can use it with two guests:
-@example
-@value{qemu_system} linux1.img -hdb nbd+unix://?socket=3D/tmp/my_socket
-@value{qemu_system} linux2.img -hdb nbd+unix://?socket=3D/tmp/my_socket
-@end example
-
-If the nbd-server uses named exports (supported since NBD 2.9.18, or with =
QEMU's
-own embedded NBD server), you must specify an export name in the URI:
-@example
-@value{qemu_system} -cdrom nbd://localhost/debian-500-ppc-netinst
-@value{qemu_system} -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
-@end example
-
-The URI syntax for NBD is supported since QEMU 1.3.  An alternative syntax=
 is
-also available.  Here are some example of the older syntax:
-@example
-@value{qemu_system} linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
-@value{qemu_system} linux2.img -hdb nbd:unix:/tmp/my_socket
-@value{qemu_system} -cdrom nbd:localhost:10809:exportname=3Ddebian-500-ppc=
-netinst
-@end example
-
-@node disk_images_sheepdog
-@subsection Sheepdog disk images
-
-Sheepdog is a distributed storage system for QEMU.  It provides highly
-available block level storage volumes that can be attached to
-QEMU-based virtual machines.
-
-You can create a Sheepdog disk image with the command:
-@example
-qemu-img create sheepdog:///@var{image} @var{size}
-@end example
-where @var{image} is the Sheepdog image name and @var{size} is its
-size.
-
-To import the existing @var{filename} to Sheepdog, you can use a
-convert command.
-@example
-qemu-img convert @var{filename} sheepdog:///@var{image}
-@end example
-
-You can boot from the Sheepdog disk image with the command:
-@example
-@value{qemu_system} sheepdog:///@var{image}
-@end example
-
-You can also create a snapshot of the Sheepdog image like qcow2.
-@example
-qemu-img snapshot -c @var{tag} sheepdog:///@var{image}
-@end example
-where @var{tag} is a tag name of the newly created snapshot.
-
-To boot from the Sheepdog snapshot, specify the tag name of the
-snapshot.
-@example
-@value{qemu_system} sheepdog:///@var{image}#@var{tag}
-@end example
-
-You can create a cloned image from the existing snapshot.
-@example
-qemu-img create -b sheepdog:///@var{base}#@var{tag} sheepdog:///@var{image}
-@end example
-where @var{base} is an image name of the source snapshot and @var{tag}
-is its tag name.
-
-You can use an unix socket instead of an inet socket:
-
-@example
-@value{qemu_system} sheepdog+unix:///@var{image}?socket=3D@var{path}
-@end example
-
-If the Sheepdog daemon doesn't run on the local host, you need to
-specify one of the Sheepdog servers to connect to.
-@example
-qemu-img create sheepdog://@var{hostname}:@var{port}/@var{image} @var{size}
-@value{qemu_system} sheepdog://@var{hostname}:@var{port}/@var{image}
-@end example
-
-@node disk_images_iscsi
-@subsection iSCSI LUNs
-
-iSCSI is a popular protocol used to access SCSI devices across a computer
-network.
-
-There are two different ways iSCSI devices can be used by QEMU.
-
-The first method is to mount the iSCSI LUN on the host, and make it appear=
 as
-any other ordinary SCSI device on the host and then to access this device =
as a
-/dev/sd device from QEMU. How to do this differs between host OSes.
-
-The second method involves using the iSCSI initiator that is built into
-QEMU. This provides a mechanism that works the same way regardless of which
-host OS you are running QEMU on. This section will describe this second me=
thod
-of using iSCSI together with QEMU.
-
-In QEMU, iSCSI devices are described using special iSCSI URLs
-
-@example
-URL syntax:
-iscsi://[<username>[%<password>]@@]<host>[:<port>]/<target-iqn-name>/<lun>
-@end example
-
-Username and password are optional and only used if your target is set up
-using CHAP authentication for access control.
-Alternatively the username and password can also be set via environment
-variables to have these not show up in the process list
-
-@example
-export LIBISCSI_CHAP_USERNAME=3D<username>
-export LIBISCSI_CHAP_PASSWORD=3D<password>
-iscsi://<host>/<target-iqn-name>/<lun>
-@end example
-
-Various session related parameters can be set via special options, either
-in a configuration file provided via '-readconfig' or directly on the
-command line.
-
-If the initiator-name is not specified qemu will use a default name
-of 'iqn.2008-11.org.linux-kvm[:<uuid>'] where <uuid> is the UUID of the
-virtual machine. If the UUID is not specified qemu will use
-'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the
-virtual machine.
-
-@example
-Setting a specific initiator name to use when logging in to the target
--iscsi initiator-name=3Diqn.qemu.test:my-initiator
-@end example
-
-@example
-Controlling which type of header digest to negotiate with the target
--iscsi header-digest=3DCRC32C|CRC32C-NONE|NONE-CRC32C|NONE
-@end example
-
-These can also be set via a configuration file
-@example
-[iscsi]
-  user =3D "CHAP username"
-  password =3D "CHAP password"
-  initiator-name =3D "iqn.qemu.test:my-initiator"
-  # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
-  header-digest =3D "CRC32C"
-@end example
-
-
-Setting the target name allows different options for different targets
-@example
-[iscsi "iqn.target.name"]
-  user =3D "CHAP username"
-  password =3D "CHAP password"
-  initiator-name =3D "iqn.qemu.test:my-initiator"
-  # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
-  header-digest =3D "CRC32C"
-@end example
-
-
-Howto use a configuration file to set iSCSI configuration options:
-@example
-cat >iscsi.conf <<EOF
-[iscsi]
-  user =3D "me"
-  password =3D "my password"
-  initiator-name =3D "iqn.qemu.test:my-initiator"
-  header-digest =3D "CRC32C"
-EOF
-
-@value{qemu_system} -drive file=3Discsi://127.0.0.1/iqn.qemu.test/1 \
-    -readconfig iscsi.conf
-@end example
-
-
-How to set up a simple iSCSI target on loopback and access it via QEMU:
-@example
-This example shows how to set up an iSCSI target with one CDROM and one DI=
SK
-using the Linux STGT software target. This target is available on Red Hat =
based
-systems as the package 'scsi-target-utils'.
-
-tgtd --iscsi portal=3D127.0.0.1:3260
-tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
-tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \
-    -b /IMAGES/disk.img --device-type=3Ddisk
-tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \
-    -b /IMAGES/cd.iso --device-type=3Dcd
-tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
-
-@value{qemu_system} -iscsi initiator-name=3Diqn.qemu.test:my-initiator \
-    -boot d -drive file=3Discsi://127.0.0.1/iqn.qemu.test/1 \
-    -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
-@end example
-
-@node disk_images_gluster
-@subsection GlusterFS disk images
-
-GlusterFS is a user space distributed file system.
-
-You can boot from the GlusterFS disk image with the command:
-@example
-URI:
-@value{qemu_system} -drive file=3Dgluster[+@var{type}]://[@var{host}[:@var=
{port}]]/@var{volume}/@var{path}
-                               [?socket=3D...][,file.debug=3D9][,file.logf=
ile=3D...]
-
-JSON:
-@value{qemu_system} 'json:@{"driver":"qcow2",
-                           "file":@{"driver":"gluster",
-                                    "volume":"testvol","path":"a.img","deb=
ug":9,"logfile":"...",
-                                    "server":[@{"type":"tcp","host":"...",=
"port":"..."@},
-                                              @{"type":"unix","socket":"..=
."@}]@}@}'
-@end example
-
-@var{gluster} is the protocol.
-
-@var{type} specifies the transport type used to connect to gluster
-management daemon (glusterd). Valid transport types are
-tcp and unix. In the URI form, if a transport type isn't specified,
-then tcp type is assumed.
-
-@var{host} specifies the server where the volume file specification for
-the given volume resides. This can be either a hostname or an ipv4 address.
-If transport type is unix, then @var{host} field should not be specified.
-Instead @var{socket} field needs to be populated with the path to unix dom=
ain
-socket.
-
-@var{port} is the port number on which glusterd is listening. This is opti=
onal
-and if not specified, it defaults to port 24007. If the transport type is =
unix,
-then @var{port} should not be specified.
-
-@var{volume} is the name of the gluster volume which contains the disk ima=
ge.
-
-@var{path} is the path to the actual disk image that resides on gluster vo=
lume.
-
-@var{debug} is the logging level of the gluster protocol driver. Debug lev=
els
-are 0-9, with 9 being the most verbose, and 0 representing no debugging ou=
tput.
-The default level is 4. The current logging levels defined in the gluster =
source
-are 0 - None, 1 - Emergency, 2 - Alert, 3 - Critical, 4 - Error, 5 - Warni=
ng,
-6 - Notice, 7 - Info, 8 - Debug, 9 - Trace
-
-@var{logfile} is a commandline option to mention log file path which helps=
 in
-logging to the specified file and also help in persisting the gfapi logs. =
The
-default is stderr.
-
-
-
-
-You can create a GlusterFS disk image with the command:
-@example
-qemu-img create gluster://@var{host}/@var{volume}/@var{path} @var{size}
-@end example
-
-Examples
-@example
-@value{qemu_system} -drive file=3Dgluster://1.2.3.4/testvol/a.img
-@value{qemu_system} -drive file=3Dgluster+tcp://1.2.3.4/testvol/a.img
-@value{qemu_system} -drive file=3Dgluster+tcp://1.2.3.4:24007/testvol/dir/=
a.img
-@value{qemu_system} -drive file=3Dgluster+tcp://[1:2:3:4:5:6:7:8]/testvol/=
dir/a.img
-@value{qemu_system} -drive file=3Dgluster+tcp://[1:2:3:4:5:6:7:8]:24007/te=
stvol/dir/a.img
-@value{qemu_system} -drive file=3Dgluster+tcp://server.domain.com:24007/te=
stvol/dir/a.img
-@value{qemu_system} -drive file=3Dgluster+unix:///testvol/dir/a.img?socket=
=3D/tmp/glusterd.socket
-@value{qemu_system} -drive file=3Dgluster+rdma://1.2.3.4:24007/testvol/a.i=
mg
-@value{qemu_system} -drive file=3Dgluster://1.2.3.4/testvol/a.img,file.deb=
ug=3D9,file.logfile=3D/var/log/qemu-gluster.log
-@value{qemu_system} 'json:@{"driver":"qcow2",
-                           "file":@{"driver":"gluster",
-                                    "volume":"testvol","path":"a.img",
-                                    "debug":9,"logfile":"/var/log/qemu-glu=
ster.log",
-                                    "server":[@{"type":"tcp","host":"1.2.3=
.4","port":24007@},
-                                              @{"type":"unix","socket":"/v=
ar/run/glusterd.socket"@}]@}@}'
-@value{qemu_system} -drive driver=3Dqcow2,file.driver=3Dgluster,file.volum=
e=3Dtestvol,file.path=3D/path/a.img,
-                                       file.debug=3D9,file.logfile=3D/var/=
log/qemu-gluster.log,
-                                       file.server.0.type=3Dtcp,file.serve=
r.0.host=3D1.2.3.4,file.server.0.port=3D24007,
-                                       file.server.1.type=3Dunix,file.serv=
er.1.socket=3D/var/run/glusterd.socket
-@end example
-
-@node disk_images_ssh
-@subsection Secure Shell (ssh) disk images
-
-You can access disk images located on a remote ssh server
-by using the ssh protocol:
-
-@example
-@value{qemu_system} -drive file=3Dssh://[@var{user}@@]@var{server}[:@var{p=
ort}]/@var{path}[?host_key_check=3D@var{host_key_check}]
-@end example
-
-Alternative syntax using properties:
-
-@example
-@value{qemu_system} -drive file.driver=3Dssh[,file.user=3D@var{user}],file=
.host=3D@var{server}[,file.port=3D@var{port}],file.path=3D@var{path}[,file.=
host_key_check=3D@var{host_key_check}]
-@end example
-
-@var{ssh} is the protocol.
-
-@var{user} is the remote user.  If not specified, then the local
-username is tried.
-
-@var{server} specifies the remote ssh server.  Any ssh server can be
-used, but it must implement the sftp-server protocol.  Most Unix/Linux
-systems should work without requiring any extra configuration.
-
-@var{port} is the port number on which sshd is listening.  By default
-the standard ssh port (22) is used.
-
-@var{path} is the path to the disk image.
-
-The optional @var{host_key_check} parameter controls how the remote
-host's key is checked.  The default is @code{yes} which means to use
-the local @file{.ssh/known_hosts} file.  Setting this to @code{no}
-turns off known-hosts checking.  Or you can check that the host key
-matches a specific fingerprint:
-@code{host_key_check=3Dmd5:78:45:8e:14:57:4f:d5:45:83:0a:0e:f3:49:82:c9:c8}
-(@code{sha1:} can also be used as a prefix, but note that OpenSSH
-tools only use MD5 to print fingerprints).
-
-Currently authentication must be done using ssh-agent.  Other
-authentication methods may be supported in future.
-
-Note: Many ssh servers do not support an @code{fsync}-style operation.
-The ssh driver cannot guarantee that disk flush requests are
-obeyed, and this causes a risk of disk corruption if the remote
-server or network goes down during writes.  The driver will
-print a warning when @code{fsync} is not supported:
-
-warning: ssh server @code{ssh.example.com:22} does not support fsync
-
-With sufficiently new versions of libssh and OpenSSH, @code{fsync} is
-supported.
-
-@node disk_images_nvme
-@subsection NVMe disk images
-
-NVM Express (NVMe) storage controllers can be accessed directly by a users=
pace
-driver in QEMU.  This bypasses the host kernel file system and block layers
-while retaining QEMU block layer functionalities, such as block jobs, I/O
-throttling, image formats, etc.  Disk I/O performance is typically higher =
than
-with @code{-drive file=3D/dev/sda} using either thread pool or linux-aio.
-
-The controller will be exclusively used by the QEMU process once started. =
To be
-able to share storage between multiple VMs and other applications on the h=
ost,
-please use the file based protocols.
-
-Before starting QEMU, bind the host NVMe controller to the host vfio-pci
-driver.  For example:
-
-@example
-# modprobe vfio-pci
-# lspci -n -s 0000:06:0d.0
-06:0d.0 0401: 1102:0002 (rev 08)
-# echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind
-# echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id
-
-# @value{qemu_system} -drive file=3Dnvme://@var{host}:@var{bus}:@var{slot}=
.@var{func}/@var{namespace}
-@end example
-
-Alternative syntax using properties:
-
-@example
-@value{qemu_system} -drive file.driver=3Dnvme,file.device=3D@var{host}:@va=
r{bus}:@var{slot}.@var{func},file.namespace=3D@var{namespace}
-@end example
-
-@var{host}:@var{bus}:@var{slot}.@var{func} is the NVMe controller's PCI de=
vice
-address on the host.
-
-@var{namespace} is the NVMe namespace number, starting from 1.
-
-@node disk_image_locking
-@subsection Disk image file locking
-
-By default, QEMU tries to protect image files from unexpected concurrent
-access, as long as it's supported by the block protocol driver and host
-operating system. If multiple QEMU processes (including QEMU emulators and
-utilities) try to open the same image with conflicting accessing modes, al=
l but
-the first one will get an error.
-
-This feature is currently supported by the file protocol on Linux with the=
 Open
-File Descriptor (OFD) locking API, and can be configured to fall back to P=
OSIX
-locking if the POSIX host doesn't support Linux OFD locking.
-
-To explicitly enable image locking, specify "locking=3Don" in the file pro=
tocol
-driver options. If OFD locking is not possible, a warning will be printed =
and
-the POSIX locking API will be used. In this case there is a risk that the =
lock
-will get silently lost when doing hot plugging and block jobs, due to the
-shortcomings of the POSIX locking API.
-
-QEMU transparently handles lock handover during shared storage migration. =
 For
-shared virtual disk images between multiple VMs, the "share-rw" device opt=
ion
-should be used.
-
-By default, the guest has exclusive write access to its disk image. If the
-guest can safely share the disk image with other writers the @code{-device
-...,share-rw=3Don} parameter can be used.  This is only safe if the guest =
is
-running software, such as a cluster file system, that coordinates disk acc=
esses
-to avoid corruption.
-
-Note that share-rw=3Don only declares the guest's ability to share the dis=
k.
-Some QEMU features, such as image file formats, require exclusive write ac=
cess
-to the disk image and this is unaffected by the share-rw=3Don option.
-
-Alternatively, locking can be fully disabled by "locking=3Doff" block devi=
ce
-option. In the command line, the option is usually in the form of
-"file.locking=3Doff" as the protocol driver is normally placed as a "file"=
 child
-under a format driver. For example:
-
-@code{-blockdev driver=3Dqcow2,file.filename=3D/path/to/image,file.locking=
=3Doff,file.driver=3Dfile}
-
-To check if image locking is active, check the output of the "lslocks" com=
mand
-on host and see if there are locks held by the QEMU process on the image f=
ile.
-More than one byte could be locked by the QEMU instance, each byte of which
-reflects a particular permission that is acquired or protected by the runn=
ing
-block driver.
-
-@c man end
-
-@ignore
-
-@setfilename qemu-block-drivers
-@settitle QEMU block drivers reference
-
-@c man begin SEEALSO
-The HTML documentation of QEMU for more precise information and Linux
-user mode emulator invocation.
-@c man end
-
-@c man begin AUTHOR
-Fabrice Bellard and the QEMU Project developers
-@c man end
-
-@end ignore
diff --git a/docs/system/conf.py b/docs/system/conf.py
index 6435b4d3f8e..7ca115f5e03 100644
--- a/docs/system/conf.py
+++ b/docs/system/conf.py
@@ -13,3 +13,10 @@ exec(compile(open(parent_config, "rb").read(), parent_co=
nfig, 'exec'))
 # This slightly misuses the 'description', but is the best way to get
 # the manual title to appear in the sidebar.
 html_theme_options['description'] =3D u'System Emulation User''s Guide'
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages =3D [
+    ('qemu-block-drivers', 'qemu-block-drivers',
+     u'QEMU block drivers reference',
+     ['Fabrice Bellard and the QEMU Project developers'], 7)
+]
diff --git a/docs/system/index.rst b/docs/system/index.rst
index ea8ea5fe3dc..f66e6ea585c 100644
--- a/docs/system/index.rst
+++ b/docs/system/index.rst
@@ -14,3 +14,4 @@ Contents:
 .. toctree::
    :maxdepth: 2
=20
+   qemu-block-drivers
diff --git a/docs/system/qemu-block-drivers.rst b/docs/system/qemu-block-dr=
ivers.rst
new file mode 100644
index 00000000000..388adbefbf4
--- /dev/null
+++ b/docs/system/qemu-block-drivers.rst
@@ -0,0 +1,985 @@
+QEMU block drivers reference
+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D
+
+.. |qemu_system| replace:: qemu-system-x86_64
+
+..
+   We put the 'Synopsis' and 'See also' sections into the manpage, but not
+   the HTML. This makes the HTML docs read better and means the ToC in
+   the index has a more useful set of entries. Ideally, the section
+   headings 'Disk image file formats' would be top-level headings for
+   the HTML, but sub-headings of the conventional manpage 'Description'
+   header for the manpage. Unfortunately, due to deficiencies in
+   the Sphinx 'only' directive, this isn't possible: they must be headers
+   at the same level as 'Synopsis' and 'See also', otherwise Sphinx's
+   identification of which header underline style is which gets confused.
+
+.. only:: man
+
+  Synopsis
+  --------
+
+  QEMU block driver reference manual
+
+Disk image file formats
+-----------------------
+
+QEMU supports many image file formats that can be used with VMs as well as=
 with
+any of the tools (like ``qemu-img``). This includes the preferred formats
+raw and qcow2 as well as formats that are supported for compatibility with
+older QEMU versions or other hypervisors.
+
+Depending on the image format, different options can be passed to
+``qemu-img create`` and ``qemu-img convert`` using the ``-o`` option.
+This section describes each format and the options that are supported for =
it.
+
+.. program:: image-formats
+.. option:: raw
+
+  Raw disk image format. This format has the advantage of
+  being simple and easily exportable to all other emulators. If your
+  file system supports *holes* (for example in ext2 or ext3 on
+  Linux or NTFS on Windows), then only the written sectors will reserve
+  space. Use ``qemu-img info`` to know the real size used by the
+  image or ``ls -ls`` on Unix/Linux.
+
+  Supported options:
+
+  .. program:: raw
+  .. option:: preallocation
+
+    Preallocation mode (allowed values: ``off``, ``falloc``,
+    ``full``). ``falloc`` mode preallocates space for image by
+    calling ``posix_fallocate()``. ``full`` mode preallocates space
+    for image by writing data to underlying storage. This data may or
+    may not be zero, depending on the storage location.
+
+.. program:: image-formats
+.. option:: qcow2
+
+  QEMU image format, the most versatile format. Use it to have smaller
+  images (useful if your filesystem does not supports holes, for example
+  on Windows), zlib based compression and support of multiple VM
+  snapshots.
+
+  Supported options:
+
+  .. program:: qcow2
+  .. option:: compat
+
+    Determines the qcow2 version to use. ``compat=3D0.10`` uses the
+    traditional image format that can be read by any QEMU since 0.10.
+    ``compat=3D1.1`` enables image format extensions that only QEMU 1.1 and
+    newer understand (this is the default). Amongst others, this includes
+    zero clusters, which allow efficient copy-on-read for sparse images.
+
+  .. option:: backing_file
+
+    File name of a base image (see ``create`` subcommand)
+
+  .. option:: backing_fmt
+
+    Image format of the base image
+
+  .. option:: encryption
+
+    This option is deprecated and equivalent to ``encrypt.format=3Daes``
+
+  .. option:: encrypt.format
+
+    If this is set to ``luks``, it requests that the qcow2 payload (not
+    qcow2 header) be encrypted using the LUKS format. The passphrase to
+    use to unlock the LUKS key slot is given by the ``encrypt.key-secret``
+    parameter. LUKS encryption parameters can be tuned with the other
+    ``encrypt.*`` parameters.
+
+    If this is set to ``aes``, the image is encrypted with 128-bit AES-CBC.
+    The encryption key is given by the ``encrypt.key-secret`` parameter.
+    This encryption format is considered to be flawed by modern cryptograp=
hy
+    standards, suffering from a number of design problems:
+
+    - The AES-CBC cipher is used with predictable initialization vectors b=
ased
+      on the sector number. This makes it vulnerable to chosen plaintext a=
ttacks
+      which can reveal the existence of encrypted data.
+    - The user passphrase is directly used as the encryption key. A poorly
+      chosen or short passphrase will compromise the security of the encry=
ption.
+    - In the event of the passphrase being compromised there is no way to
+      change the passphrase to protect data in any qcow images. The files =
must
+      be cloned, using a different encryption passphrase in the new file. =
The
+      original file must then be securely erased using a program like shre=
d,
+      though even this is ineffective with many modern storage technologie=
s.
+
+    The use of this is no longer supported in system emulators. Support on=
ly
+    remains in the command line utilities, for the purposes of data libera=
tion
+    and interoperability with old versions of QEMU. The ``luks`` format
+    should be used instead.
+
+  .. option:: encrypt.key-secret
+
+    Provides the ID of a ``secret`` object that contains the passphrase
+    (``encrypt.format=3Dluks``) or encryption key (``encrypt.format=3Daes`=
`).
+
+  .. option:: encrypt.cipher-alg
+
+    Name of the cipher algorithm and key length. Currently defaults
+    to ``aes-256``. Only used when ``encrypt.format=3Dluks``.
+
+  .. option:: encrypt.cipher-mode
+
+    Name of the encryption mode to use. Currently defaults to ``xts``.
+    Only used when ``encrypt.format=3Dluks``.
+
+  .. option:: encrypt.ivgen-alg
+
+    Name of the initialization vector generator algorithm. Currently defau=
lts
+    to ``plain64``. Only used when ``encrypt.format=3Dluks``.
+
+  .. option:: encrypt.ivgen-hash-alg
+
+    Name of the hash algorithm to use with the initialization vector gener=
ator
+    (if required). Defaults to ``sha256``. Only used when ``encrypt.format=
=3Dluks``.
+
+  .. option:: encrypt.hash-alg
+
+    Name of the hash algorithm to use for PBKDF algorithm
+    Defaults to ``sha256``. Only used when ``encrypt.format=3Dluks``.
+
+  .. option:: encrypt.iter-time
+
+    Amount of time, in milliseconds, to use for PBKDF algorithm per key sl=
ot.
+    Defaults to ``2000``. Only used when ``encrypt.format=3Dluks``.
+
+  .. option:: cluster_size
+
+    Changes the qcow2 cluster size (must be between 512 and 2M). Smaller c=
luster
+    sizes can improve the image file size whereas larger cluster sizes gen=
erally
+    provide better performance.
+
+  .. option:: preallocation
+
+    Preallocation mode (allowed values: ``off``, ``metadata``, ``falloc``,
+    ``full``). An image with preallocated metadata is initially larger but=
 can
+    improve performance when the image needs to grow. ``falloc`` and ``ful=
l``
+    preallocations are like the same options of ``raw`` format, but sets up
+    metadata also.
+
+  .. option:: lazy_refcounts
+
+    If this option is set to ``on``, reference count updates are postponed=
 with
+    the goal of avoiding metadata I/O and improving performance. This is
+    particularly interesting with :option:`cache=3Dwritethrough` which doe=
sn't batch
+    metadata updates. The tradeoff is that after a host crash, the referen=
ce count
+    tables must be rebuilt, i.e. on the next open an (automatic) ``qemu-img
+    check -r all`` is required, which may take some time.
+
+    This option can only be enabled if ``compat=3D1.1`` is specified.
+
+  .. option:: nocow
+
+    If this option is set to ``on``, it will turn off COW of the file. It'=
s only
+    valid on btrfs, no effect on other file systems.
+
+    Btrfs has low performance when hosting a VM image file, even more
+    when the guest on the VM also using btrfs as file system. Turning off
+    COW is a way to mitigate this bad performance. Generally there are two
+    ways to turn off COW on btrfs:
+
+    - Disable it by mounting with nodatacow, then all newly created files
+      will be NOCOW.
+    - For an empty file, add the NOCOW file attribute. That's what this
+      option does.
+
+    Note: this option is only valid to new or empty files. If there is
+    an existing file which is COW and has data blocks already, it couldn't
+    be changed to NOCOW by setting ``nocow=3Don``. One can issue ``lsattr
+    filename`` to check if the NOCOW flag is set or not (Capital 'C' is
+    NOCOW flag).
+
+.. program:: image-formats
+.. option:: qed
+
+   Old QEMU image format with support for backing files and compact image =
files
+   (when your filesystem or transport medium does not support holes).
+
+   When converting QED images to qcow2, you might want to consider using t=
he
+   ``lazy_refcounts=3Don`` option to get a more QED-like behaviour.
+
+   Supported options:
+
+   .. program:: qed
+   .. option:: backing_file
+
+      File name of a base image (see ``create`` subcommand).
+
+   .. option:: backing_fmt
+
+     Image file format of backing file (optional).  Useful if the format c=
annot be
+     autodetected because it has no header, like some vhd/vpc files.
+
+   .. option:: cluster_size
+
+     Changes the cluster size (must be power-of-2 between 4K and 64K). Sma=
ller
+     cluster sizes can improve the image file size whereas larger cluster =
sizes
+     generally provide better performance.
+
+   .. option:: table_size
+
+     Changes the number of clusters per L1/L2 table (must be
+     power-of-2 between 1 and 16).  There is normally no need to
+     change this value but this option can between used for
+     performance benchmarking.
+
+.. program:: image-formats
+.. option:: qcow
+
+  Old QEMU image format with support for backing files, compact image file=
s,
+  encryption and compression.
+
+  Supported options:
+
+   .. program:: qcow
+   .. option:: backing_file
+
+     File name of a base image (see ``create`` subcommand)
+
+   .. option:: encryption
+
+     This option is deprecated and equivalent to ``encrypt.format=3Daes``
+
+   .. option:: encrypt.format
+
+     If this is set to ``aes``, the image is encrypted with 128-bit AES-CB=
C.
+     The encryption key is given by the ``encrypt.key-secret`` parameter.
+     This encryption format is considered to be flawed by modern cryptogra=
phy
+     standards, suffering from a number of design problems enumerated prev=
iously
+     against the ``qcow2`` image format.
+
+     The use of this is no longer supported in system emulators. Support o=
nly
+     remains in the command line utilities, for the purposes of data liber=
ation
+     and interoperability with old versions of QEMU.
+
+     Users requiring native encryption should use the ``qcow2`` format
+     instead with ``encrypt.format=3Dluks``.
+
+   .. option:: encrypt.key-secret
+
+     Provides the ID of a ``secret`` object that contains the encryption
+     key (``encrypt.format=3Daes``).
+
+.. program:: image-formats
+.. option:: luks
+
+  LUKS v1 encryption format, compatible with Linux dm-crypt/cryptsetup
+
+  Supported options:
+
+  .. program:: luks
+  .. option:: key-secret
+
+    Provides the ID of a ``secret`` object that contains the passphrase.
+
+  .. option:: cipher-alg
+
+    Name of the cipher algorithm and key length. Currently defaults
+    to ``aes-256``.
+
+  .. option:: cipher-mode
+
+    Name of the encryption mode to use. Currently defaults to ``xts``.
+
+  .. option:: ivgen-alg
+
+    Name of the initialization vector generator algorithm. Currently defau=
lts
+    to ``plain64``.
+
+  .. option:: ivgen-hash-alg
+
+    Name of the hash algorithm to use with the initialization vector gener=
ator
+    (if required). Defaults to ``sha256``.
+
+  .. option:: hash-alg
+
+    Name of the hash algorithm to use for PBKDF algorithm
+    Defaults to ``sha256``.
+
+  .. option:: iter-time
+
+    Amount of time, in milliseconds, to use for PBKDF algorithm per key sl=
ot.
+    Defaults to ``2000``.
+
+.. program:: image-formats
+.. option:: vdi
+
+  VirtualBox 1.1 compatible image format.
+
+  Supported options:
+
+  .. program:: vdi
+  .. option:: static
+
+    If this option is set to ``on``, the image is created with metadata
+    preallocation.
+
+.. program:: image-formats
+.. option:: vmdk
+
+  VMware 3 and 4 compatible image format.
+
+  Supported options:
+
+  .. program: vmdk
+  .. option:: backing_file
+
+    File name of a base image (see ``create`` subcommand).
+
+  .. option:: compat6
+
+    Create a VMDK version 6 image (instead of version 4)
+
+  .. option:: hwversion
+
+    Specify vmdk virtual hardware version. Compat6 flag cannot be enabled
+    if hwversion is specified.
+
+  .. option:: subformat
+
+    Specifies which VMDK subformat to use. Valid options are
+    ``monolithicSparse`` (default),
+    ``monolithicFlat``,
+    ``twoGbMaxExtentSparse``,
+    ``twoGbMaxExtentFlat`` and
+    ``streamOptimized``.
+
+.. program:: image-formats
+.. option:: vpc
+
+  VirtualPC compatible image format (VHD).
+
+  Supported options:
+
+  .. program:: vpc
+  .. option:: subformat
+
+    Specifies which VHD subformat to use. Valid options are
+    ``dynamic`` (default) and ``fixed``.
+
+.. program:: image-formats
+.. option:: VHDX
+
+  Hyper-V compatible image format (VHDX).
+
+  Supported options:
+
+  .. program:: VHDX
+  .. option:: subformat
+
+    Specifies which VHDX subformat to use. Valid options are
+    ``dynamic`` (default) and ``fixed``.
+
+    .. option:: block_state_zero
+
+      Force use of payload blocks of type 'ZERO'.  Can be set to ``on`` (d=
efault)
+      or ``off``.  When set to ``off``, new blocks will be created as
+      ``PAYLOAD_BLOCK_NOT_PRESENT``, which means parsers are free to return
+      arbitrary data for those blocks.  Do not set to ``off`` when using
+      ``qemu-img convert`` with ``subformat=3Ddynamic``.
+
+    .. option:: block_size
+
+      Block size; min 1 MB, max 256 MB.  0 means auto-calculate based on
+      image size.
+
+    .. option:: log_size
+
+      Log size; min 1 MB.
+
+Read-only formats
+-----------------
+
+More disk image file formats are supported in a read-only mode.
+
+.. program:: image-formats
+.. option:: bochs
+
+  Bochs images of ``growing`` type.
+
+.. program:: image-formats
+.. option:: cloop
+
+  Linux Compressed Loop image, useful only to reuse directly compressed
+  CD-ROM images present for example in the Knoppix CD-ROMs.
+
+.. program:: image-formats
+.. option:: dmg
+
+  Apple disk image.
+
+.. program:: image-formats
+.. option:: parallels
+
+  Parallels disk image format.
+
+Using host drives
+-----------------
+
+In addition to disk image files, QEMU can directly access host
+devices. We describe here the usage for QEMU version >=3D 0.8.3.
+
+Linux
+'''''
+
+On Linux, you can directly use the host device filename instead of a
+disk image filename provided you have enough privileges to access
+it. For example, use ``/dev/cdrom`` to access to the CDROM.
+
+CD
+  You can specify a CDROM device even if no CDROM is loaded. QEMU has
+  specific code to detect CDROM insertion or removal. CDROM ejection by
+  the guest OS is supported. Currently only data CDs are supported.
+
+Floppy
+  You can specify a floppy device even if no floppy is loaded. Floppy
+  removal is currently not detected accurately (if you change floppy
+  without doing floppy access while the floppy is not loaded, the guest
+  OS will think that the same floppy is loaded).
+  Use of the host's floppy device is deprecated, and support for it will
+  be removed in a future release.
+
+Hard disks
+  Hard disks can be used. Normally you must specify the whole disk
+  (``/dev/hdb`` instead of ``/dev/hdb1``) so that the guest OS can
+  see it as a partitioned disk. WARNING: unless you know what you do, it
+  is better to only make READ-ONLY accesses to the hard disk otherwise
+  you may corrupt your host data (use the ``-snapshot`` command
+  line option or modify the device permissions accordingly).
+
+Windows
+'''''''
+
+CD
+  The preferred syntax is the drive letter (e.g. ``d:``). The
+  alternate syntax ``\\.\d:`` is supported. ``/dev/cdrom`` is
+  supported as an alias to the first CDROM drive.
+
+  Currently there is no specific code to handle removable media, so it
+  is better to use the ``change`` or ``eject`` monitor commands to
+  change or eject media.
+
+Hard disks
+  Hard disks can be used with the syntax: ``\\.\PhysicalDriveN``
+  where *N* is the drive number (0 is the first hard disk).
+
+  WARNING: unless you know what you do, it is better to only make
+  READ-ONLY accesses to the hard disk otherwise you may corrupt your
+  host data (use the ``-snapshot`` command line so that the
+  modifications are written in a temporary file).
+
+Mac OS X
+''''''''
+
+``/dev/cdrom`` is an alias to the first CDROM.
+
+Currently there is no specific code to handle removable media, so it
+is better to use the ``change`` or ``eject`` monitor commands to
+change or eject media.
+
+Virtual FAT disk images
+-----------------------
+
+QEMU can automatically create a virtual FAT disk image from a
+directory tree. In order to use it, just type:
+
+.. parsed-literal::
+
+  |qemu_system| linux.img -hdb fat:/my_directory
+
+Then you access access to all the files in the ``/my_directory``
+directory without having to copy them in a disk image or to export
+them via SAMBA or NFS. The default access is *read-only*.
+
+Floppies can be emulated with the ``:floppy:`` option:
+
+.. parsed-literal::
+
+  |qemu_system| linux.img -fda fat:floppy:/my_directory
+
+A read/write support is available for testing (beta stage) with the
+``:rw:`` option:
+
+.. parsed-literal::
+
+  |qemu_system| linux.img -fda fat:floppy:rw:/my_directory
+
+What you should *never* do:
+
+- use non-ASCII filenames
+- use "-snapshot" together with ":rw:"
+- expect it to work when loadvm'ing
+- write to the FAT directory on the host system while accessing it with th=
e guest system
+
+NBD access
+----------
+
+QEMU can access directly to block device exported using the Network Block =
Device
+protocol.
+
+.. parsed-literal::
+
+  |qemu_system| linux.img -hdb nbd://my_nbd_server.mydomain.org:1024/
+
+If the NBD server is located on the same host, you can use an unix socket =
instead
+of an inet socket:
+
+.. parsed-literal::
+
+  |qemu_system| linux.img -hdb nbd+unix://?socket=3D/tmp/my_socket
+
+In this case, the block device must be exported using qemu-nbd:
+
+.. parsed-literal::
+
+  qemu-nbd --socket=3D/tmp/my_socket my_disk.qcow2
+
+The use of qemu-nbd allows sharing of a disk between several guests:
+
+.. parsed-literal::
+
+  qemu-nbd --socket=3D/tmp/my_socket --share=3D2 my_disk.qcow2
+
+and then you can use it with two guests:
+
+.. parsed-literal::
+
+  |qemu_system| linux1.img -hdb nbd+unix://?socket=3D/tmp/my_socket
+  |qemu_system| linux2.img -hdb nbd+unix://?socket=3D/tmp/my_socket
+
+If the nbd-server uses named exports (supported since NBD 2.9.18, or with =
QEMU's
+own embedded NBD server), you must specify an export name in the URI:
+
+.. parsed-literal::
+
+  |qemu_system| -cdrom nbd://localhost/debian-500-ppc-netinst
+  |qemu_system| -cdrom nbd://localhost/openSUSE-11.1-ppc-netinst
+
+The URI syntax for NBD is supported since QEMU 1.3.  An alternative syntax=
 is
+also available.  Here are some example of the older syntax:
+
+.. parsed-literal::
+
+  |qemu_system| linux.img -hdb nbd:my_nbd_server.mydomain.org:1024
+  |qemu_system| linux2.img -hdb nbd:unix:/tmp/my_socket
+  |qemu_system| -cdrom nbd:localhost:10809:exportname=3Ddebian-500-ppc-net=
inst
+
+
+
+Sheepdog disk images
+--------------------
+
+Sheepdog is a distributed storage system for QEMU.  It provides highly
+available block level storage volumes that can be attached to
+QEMU-based virtual machines.
+
+You can create a Sheepdog disk image with the command:
+
+.. parsed-literal::
+
+  qemu-img create sheepdog:///IMAGE SIZE
+
+where *IMAGE* is the Sheepdog image name and *SIZE* is its
+size.
+
+To import the existing *FILENAME* to Sheepdog, you can use a
+convert command.
+
+.. parsed-literal::
+
+  qemu-img convert FILENAME sheepdog:///IMAGE
+
+You can boot from the Sheepdog disk image with the command:
+
+.. parsed-literal::
+
+  |qemu_system| sheepdog:///IMAGE
+
+You can also create a snapshot of the Sheepdog image like qcow2.
+
+.. parsed-literal::
+
+  qemu-img snapshot -c TAG sheepdog:///IMAGE
+
+where *TAG* is a tag name of the newly created snapshot.
+
+To boot from the Sheepdog snapshot, specify the tag name of the
+snapshot.
+
+.. parsed-literal::
+
+  |qemu_system| sheepdog:///IMAGE#TAG
+
+You can create a cloned image from the existing snapshot.
+
+.. parsed-literal::
+
+  qemu-img create -b sheepdog:///BASE#TAG sheepdog:///IMAGE
+
+where *BASE* is an image name of the source snapshot and *TAG*
+is its tag name.
+
+You can use an unix socket instead of an inet socket:
+
+.. parsed-literal::
+
+  |qemu_system| sheepdog+unix:///IMAGE?socket=3DPATH
+
+If the Sheepdog daemon doesn't run on the local host, you need to
+specify one of the Sheepdog servers to connect to.
+
+.. parsed-literal::
+
+  qemu-img create sheepdog://HOSTNAME:PORT/IMAGE SIZE
+  |qemu_system| sheepdog://HOSTNAME:PORT/IMAGE
+
+iSCSI LUNs
+----------
+
+iSCSI is a popular protocol used to access SCSI devices across a computer
+network.
+
+There are two different ways iSCSI devices can be used by QEMU.
+
+The first method is to mount the iSCSI LUN on the host, and make it appear=
 as
+any other ordinary SCSI device on the host and then to access this device =
as a
+/dev/sd device from QEMU. How to do this differs between host OSes.
+
+The second method involves using the iSCSI initiator that is built into
+QEMU. This provides a mechanism that works the same way regardless of which
+host OS you are running QEMU on. This section will describe this second me=
thod
+of using iSCSI together with QEMU.
+
+In QEMU, iSCSI devices are described using special iSCSI URLs. URL syntax:
+
+::
+
+  iscsi://[<username>[%<password>]@]<host>[:<port>]/<target-iqn-name>/<lun>
+
+Username and password are optional and only used if your target is set up
+using CHAP authentication for access control.
+Alternatively the username and password can also be set via environment
+variables to have these not show up in the process list:
+
+::
+
+  export LIBISCSI_CHAP_USERNAME=3D<username>
+  export LIBISCSI_CHAP_PASSWORD=3D<password>
+  iscsi://<host>/<target-iqn-name>/<lun>
+
+Various session related parameters can be set via special options, either
+in a configuration file provided via '-readconfig' or directly on the
+command line.
+
+If the initiator-name is not specified qemu will use a default name
+of 'iqn.2008-11.org.linux-kvm[:<uuid>'] where <uuid> is the UUID of the
+virtual machine. If the UUID is not specified qemu will use
+'iqn.2008-11.org.linux-kvm[:<name>'] where <name> is the name of the
+virtual machine.
+
+Setting a specific initiator name to use when logging in to the target:
+
+::
+
+  -iscsi initiator-name=3Diqn.qemu.test:my-initiator
+
+Controlling which type of header digest to negotiate with the target:
+
+::
+
+  -iscsi header-digest=3DCRC32C|CRC32C-NONE|NONE-CRC32C|NONE
+
+These can also be set via a configuration file:
+
+::
+
+  [iscsi]
+    user =3D "CHAP username"
+    password =3D "CHAP password"
+    initiator-name =3D "iqn.qemu.test:my-initiator"
+    # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
+    header-digest =3D "CRC32C"
+
+Setting the target name allows different options for different targets:
+
+::
+
+  [iscsi "iqn.target.name"]
+    user =3D "CHAP username"
+    password =3D "CHAP password"
+    initiator-name =3D "iqn.qemu.test:my-initiator"
+    # header digest is one of CRC32C|CRC32C-NONE|NONE-CRC32C|NONE
+    header-digest =3D "CRC32C"
+
+How to use a configuration file to set iSCSI configuration options:
+
+.. parsed-literal::
+
+  cat >iscsi.conf <<EOF
+  [iscsi]
+    user =3D "me"
+    password =3D "my password"
+    initiator-name =3D "iqn.qemu.test:my-initiator"
+    header-digest =3D "CRC32C"
+  EOF
+
+  |qemu_system| -drive file=3Discsi://127.0.0.1/iqn.qemu.test/1 \\
+    -readconfig iscsi.conf
+
+How to set up a simple iSCSI target on loopback and access it via QEMU:
+this example shows how to set up an iSCSI target with one CDROM and one DI=
SK
+using the Linux STGT software target. This target is available on Red Hat =
based
+systems as the package 'scsi-target-utils'.
+
+.. parsed-literal::
+
+  tgtd --iscsi portal=3D127.0.0.1:3260
+  tgtadm --lld iscsi --op new --mode target --tid 1 -T iqn.qemu.test
+  tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 \\
+      -b /IMAGES/disk.img --device-type=3Ddisk
+  tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 \\
+      -b /IMAGES/cd.iso --device-type=3Dcd
+  tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL
+
+  |qemu_system| -iscsi initiator-name=3Diqn.qemu.test:my-initiator \\
+    -boot d -drive file=3Discsi://127.0.0.1/iqn.qemu.test/1 \\
+    -cdrom iscsi://127.0.0.1/iqn.qemu.test/2
+
+GlusterFS disk images
+---------------------
+
+GlusterFS is a user space distributed file system.
+
+You can boot from the GlusterFS disk image with the command:
+
+URI:
+
+.. parsed-literal::
+
+  |qemu_system| -drive file=3Dgluster[+TYPE]://[HOST}[:PORT]]/VOLUME/PATH
+                               [?socket=3D...][,file.debug=3D9][,file.logf=
ile=3D...]
+
+JSON:
+
+.. parsed-literal::
+
+  |qemu_system| 'json:{"driver":"qcow2",
+                           "file":{"driver":"gluster",
+                                    "volume":"testvol","path":"a.img","deb=
ug":9,"logfile":"...",
+                                    "server":[{"type":"tcp","host":"...","=
port":"..."},
+                                              {"type":"unix","socket":"...=
"}]}}'
+
+*gluster* is the protocol.
+
+*TYPE* specifies the transport type used to connect to gluster
+management daemon (glusterd). Valid transport types are
+tcp and unix. In the URI form, if a transport type isn't specified,
+then tcp type is assumed.
+
+*HOST* specifies the server where the volume file specification for
+the given volume resides. This can be either a hostname or an ipv4 address.
+If transport type is unix, then *HOST* field should not be specified.
+Instead *socket* field needs to be populated with the path to unix domain
+socket.
+
+*PORT* is the port number on which glusterd is listening. This is optional
+and if not specified, it defaults to port 24007. If the transport type is =
unix,
+then *PORT* should not be specified.
+
+*VOLUME* is the name of the gluster volume which contains the disk image.
+
+*PATH* is the path to the actual disk image that resides on gluster volume.
+
+*debug* is the logging level of the gluster protocol driver. Debug levels
+are 0-9, with 9 being the most verbose, and 0 representing no debugging ou=
tput.
+The default level is 4. The current logging levels defined in the gluster =
source
+are 0 - None, 1 - Emergency, 2 - Alert, 3 - Critical, 4 - Error, 5 - Warni=
ng,
+6 - Notice, 7 - Info, 8 - Debug, 9 - Trace
+
+*logfile* is a commandline option to mention log file path which helps in
+logging to the specified file and also help in persisting the gfapi logs. =
The
+default is stderr.
+
+You can create a GlusterFS disk image with the command:
+
+.. parsed-literal::
+
+  qemu-img create gluster://HOST/VOLUME/PATH SIZE
+
+Examples
+
+.. parsed-literal::
+
+  |qemu_system| -drive file=3Dgluster://1.2.3.4/testvol/a.img
+  |qemu_system| -drive file=3Dgluster+tcp://1.2.3.4/testvol/a.img
+  |qemu_system| -drive file=3Dgluster+tcp://1.2.3.4:24007/testvol/dir/a.img
+  |qemu_system| -drive file=3Dgluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/=
a.img
+  |qemu_system| -drive file=3Dgluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvo=
l/dir/a.img
+  |qemu_system| -drive file=3Dgluster+tcp://server.domain.com:24007/testvo=
l/dir/a.img
+  |qemu_system| -drive file=3Dgluster+unix:///testvol/dir/a.img?socket=3D/=
tmp/glusterd.socket
+  |qemu_system| -drive file=3Dgluster+rdma://1.2.3.4:24007/testvol/a.img
+  |qemu_system| -drive file=3Dgluster://1.2.3.4/testvol/a.img,file.debug=
=3D9,file.logfile=3D/var/log/qemu-gluster.log
+  |qemu_system| 'json:{"driver":"qcow2",
+                           "file":{"driver":"gluster",
+                                    "volume":"testvol","path":"a.img",
+                                    "debug":9,"logfile":"/var/log/qemu-glu=
ster.log",
+                                    "server":[{"type":"tcp","host":"1.2.3.=
4","port":24007},
+                                              {"type":"unix","socket":"/va=
r/run/glusterd.socket"}]}}'
+  |qemu_system| -drive driver=3Dqcow2,file.driver=3Dgluster,file.volume=3D=
testvol,file.path=3D/path/a.img,
+                                       file.debug=3D9,file.logfile=3D/var/=
log/qemu-gluster.log,
+                                       file.server.0.type=3Dtcp,file.serve=
r.0.host=3D1.2.3.4,file.server.0.port=3D24007,
+                                       file.server.1.type=3Dunix,file.serv=
er.1.socket=3D/var/run/glusterd.socket
+
+Secure Shell (ssh) disk images
+------------------------------
+
+You can access disk images located on a remote ssh server
+by using the ssh protocol:
+
+.. parsed-literal::
+
+  |qemu_system| -drive file=3Dssh://[USER@]SERVER[:PORT]/PATH[?host_key_ch=
eck=3DHOST_KEY_CHECK]
+
+Alternative syntax using properties:
+
+.. parsed-literal::
+
+  |qemu_system| -drive file.driver=3Dssh[,file.user=3DUSER],file.host=3DSE=
RVER[,file.port=3DPORT],file.path=3DPATH[,file.host_key_check=3DHOST_KEY_CH=
ECK]
+
+*ssh* is the protocol.
+
+*USER* is the remote user.  If not specified, then the local
+username is tried.
+
+*SERVER* specifies the remote ssh server.  Any ssh server can be
+used, but it must implement the sftp-server protocol.  Most Unix/Linux
+systems should work without requiring any extra configuration.
+
+*PORT* is the port number on which sshd is listening.  By default
+the standard ssh port (22) is used.
+
+*PATH* is the path to the disk image.
+
+The optional *HOST_KEY_CHECK* parameter controls how the remote
+host's key is checked.  The default is ``yes`` which means to use
+the local ``.ssh/known_hosts`` file.  Setting this to ``no``
+turns off known-hosts checking.  Or you can check that the host key
+matches a specific fingerprint:
+``host_key_check=3Dmd5:78:45:8e:14:57:4f:d5:45:83:0a:0e:f3:49:82:c9:c8``
+(``sha1:`` can also be used as a prefix, but note that OpenSSH
+tools only use MD5 to print fingerprints).
+
+Currently authentication must be done using ssh-agent.  Other
+authentication methods may be supported in future.
+
+Note: Many ssh servers do not support an ``fsync``-style operation.
+The ssh driver cannot guarantee that disk flush requests are
+obeyed, and this causes a risk of disk corruption if the remote
+server or network goes down during writes.  The driver will
+print a warning when ``fsync`` is not supported:
+
+::
+
+  warning: ssh server ssh.example.com:22 does not support fsync
+
+With sufficiently new versions of libssh and OpenSSH, ``fsync`` is
+supported.
+
+NVMe disk images
+----------------
+
+NVM Express (NVMe) storage controllers can be accessed directly by a users=
pace
+driver in QEMU.  This bypasses the host kernel file system and block layers
+while retaining QEMU block layer functionalities, such as block jobs, I/O
+throttling, image formats, etc.  Disk I/O performance is typically higher =
than
+with ``-drive file=3D/dev/sda`` using either thread pool or linux-aio.
+
+The controller will be exclusively used by the QEMU process once started. =
To be
+able to share storage between multiple VMs and other applications on the h=
ost,
+please use the file based protocols.
+
+Before starting QEMU, bind the host NVMe controller to the host vfio-pci
+driver.  For example:
+
+.. parsed-literal::
+
+  # modprobe vfio-pci
+  # lspci -n -s 0000:06:0d.0
+  06:0d.0 0401: 1102:0002 (rev 08)
+  # echo 0000:06:0d.0 > /sys/bus/pci/devices/0000:06:0d.0/driver/unbind
+  # echo 1102 0002 > /sys/bus/pci/drivers/vfio-pci/new_id
+
+  # |qemu_system| -drive file=3Dnvme://HOST:BUS:SLOT.FUNC/NAMESPACE
+
+Alternative syntax using properties:
+
+.. parsed-literal::
+
+  |qemu_system| -drive file.driver=3Dnvme,file.device=3DHOST:BUS:SLOT.FUNC=
,file.namespace=3DNAMESPACE
+
+*HOST*:*BUS*:*SLOT*.\ *FUNC* is the NVMe controller's PCI device
+address on the host.
+
+*NAMESPACE* is the NVMe namespace number, starting from 1.
+
+Disk image file locking
+-----------------------
+
+By default, QEMU tries to protect image files from unexpected concurrent
+access, as long as it's supported by the block protocol driver and host
+operating system. If multiple QEMU processes (including QEMU emulators and
+utilities) try to open the same image with conflicting accessing modes, al=
l but
+the first one will get an error.
+
+This feature is currently supported by the file protocol on Linux with the=
 Open
+File Descriptor (OFD) locking API, and can be configured to fall back to P=
OSIX
+locking if the POSIX host doesn't support Linux OFD locking.
+
+To explicitly enable image locking, specify "locking=3Don" in the file pro=
tocol
+driver options. If OFD locking is not possible, a warning will be printed =
and
+the POSIX locking API will be used. In this case there is a risk that the =
lock
+will get silently lost when doing hot plugging and block jobs, due to the
+shortcomings of the POSIX locking API.
+
+QEMU transparently handles lock handover during shared storage migration. =
 For
+shared virtual disk images between multiple VMs, the "share-rw" device opt=
ion
+should be used.
+
+By default, the guest has exclusive write access to its disk image. If the
+guest can safely share the disk image with other writers the
+``-device ...,share-rw=3Don`` parameter can be used.  This is only safe if
+the guest is running software, such as a cluster file system, that
+coordinates disk accesses to avoid corruption.
+
+Note that share-rw=3Don only declares the guest's ability to share the dis=
k.
+Some QEMU features, such as image file formats, require exclusive write ac=
cess
+to the disk image and this is unaffected by the share-rw=3Don option.
+
+Alternatively, locking can be fully disabled by "locking=3Doff" block devi=
ce
+option. In the command line, the option is usually in the form of
+"file.locking=3Doff" as the protocol driver is normally placed as a "file"=
 child
+under a format driver. For example:
+
+::
+
+  -blockdev driver=3Dqcow2,file.filename=3D/path/to/image,file.locking=3Do=
ff,file.driver=3Dfile
+
+To check if image locking is active, check the output of the "lslocks" com=
mand
+on host and see if there are locks held by the QEMU process on the image f=
ile.
+More than one byte could be locked by the QEMU instance, each byte of which
+reflects a particular permission that is acquired or protected by the runn=
ing
+block driver.
+
+.. only:: man
+
+  See also
+  --------
+
+  The HTML documentation of QEMU for more precise information and Linux
+  user mode emulator invocation.
diff --git a/qemu-doc.texi b/qemu-doc.texi
index 617485d1461..2328e7ea476 100644
--- a/qemu-doc.texi
+++ b/qemu-doc.texi
@@ -633,16 +633,6 @@ encrypted disk images.
 * disk_images_snapshot_mode:: Snapshot mode
 * vm_snapshots::              VM snapshots
 * qemu_img_invocation::       qemu-img Invocation
-* disk_images_formats::       Disk image file formats
-* host_drives::               Using host drives
-* disk_images_fat_images::    Virtual FAT disk images
-* disk_images_nbd::           NBD access
-* disk_images_sheepdog::      Sheepdog disk images
-* disk_images_iscsi::         iSCSI LUNs
-* disk_images_gluster::       GlusterFS disk images
-* disk_images_ssh::           Secure Shell (ssh) disk images
-* disk_images_nvme::          NVMe userspace driver
-* disk_image_locking::        Disk image file locking
 @end menu
=20
 @node disk_images_quickstart
@@ -723,8 +713,6 @@ state is not saved or restored properly (in particular =
USB).
=20
 @include qemu-img.texi
=20
-@include docs/qemu-block-drivers.texi
-
 @node pcsys_network
 @section Network emulation
=20
diff --git a/qemu-options.hx b/qemu-options.hx
index 709162c159a..224a8e8712a 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -953,7 +953,7 @@ STEXI
 @findex -cdrom
 Use @var{file} as CD-ROM image (you cannot use @option{-hdc} and
 @option{-cdrom} at the same time). You can use the host CD-ROM by
-using @file{/dev/cdrom} as filename (@pxref{host_drives}).
+using @file{/dev/cdrom} as filename.
 ETEXI
=20
 DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579803908; cv=none;
	d=zohomail.com; s=zohoarc;
	b=kTHwis5EbzgyZRG/cylXUiFdA0hVWqE3ppbr45VjaYOSPoXlyZ1qH3FeGE1PRuuUaOdpcOuga9g71exq9Bhqq9HSmoub9JzWj0ts0l5FH2FLXjklSycCeHKdVLSr/Tl+F53kLV/5GvA82GovJG523QgOt5alyeYIsOWNC1Dpx1M=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579803908;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=lVlJ9nNpJHZTQ3ZPiUhA/OdyumpiTx8ozKH1nHzGqvU=;
	b=O3wFx61aDph1JF5IM7eQ6sZq6FHpoKaiV9b42YECmjU8y0fHUWimCaQvt/aY614geAY+VrLTJu4W9Cy8yKF+IMLKZL1IBvqAS6w7oZgfBN8eLxekUBROyW9KQJMdP1a26CogoUNgzyWciV++AK81zGBRNcn+xYkXYfMsge/3PV8=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 157980390784321.98103498905732;
 Thu, 23 Jan 2020 10:25:07 -0800 (PST)
Received: from localhost ([::1]:34650 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iuhA8-0000Qy-0o
	for importer@patchew.org; Thu, 23 Jan 2020 13:25:04 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48416)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRf-0000Q0-9A
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:02 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRd-0003mc-AN
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:59 -0500
Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:40739)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRd-0003lD-34
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:57 -0500
Received: by mail-wm1-x32c.google.com with SMTP id t14so2967040wmi.5
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:56 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.54
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=lVlJ9nNpJHZTQ3ZPiUhA/OdyumpiTx8ozKH1nHzGqvU=;
 b=b3Cs9/pf9pPoFRh074WJmPJruEqjiyt+r4erJxLgdtG/wedn5OLaqJEOTcVAYScE+Y
 rIHxtF/rYs4DYxIynDwjp9Ez26ScDS/LRXpOVJkO/SKUkpyWanFQUgL5vmTAhesDI0dD
 KXCTxISPR32tDJNMZaC7yTT82mM3jLyCYYRXjx5U5AZw9T9wEhF3jdDUHizIaCF4A/ux
 +nIb5EM5dfzgf3tpaSBqeiCY54soh1/JcCOkIN9rUHwoifv9pnD//80xo61cpn0hrrFB
 PRCTrkPU1eFYPISd8GQ9MX9l5ld8e5qkBwNoOYMpp9ON5M4Bqg9NmUsS+dVUjVfs/UCP
 1pAg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=lVlJ9nNpJHZTQ3ZPiUhA/OdyumpiTx8ozKH1nHzGqvU=;
 b=lCjTzF+96hMmwrbYxviojyvkBrWSdhH14pUAbTeiS5AbgWm3s0oipwgAod6fDp201s
 HtXGJY6/duUJmcT2urdymYF5vmtfsOlRjhj7DuMAU5TMQjcjvHW7YdSgPJ2sOGSxxnSJ
 nXx+FznY70ladp5Ow1nj1Vq9yyTAa8bKCBLMGo3Q0KtJXCXV3LG0Emjqr82wlUClqhkI
 qrcTNBNdy1LMvDLzUfEL7zVmB+fMh2f8GydjdSehOa8e4uyoM3ZI/bpjVaXiLcXo8kz4
 LeFU7LrCAk81I0qo074747KQIBkTo6nU95Ux6eGIRYaNV7hvDx4XbBPeFKhBbkOWM0/l
 b4fQ==
X-Gm-Message-State: APjAAAWRyfZiHz+aclnFhqv4LhcZ0b52SwerxiKka0sfM/22U2PkDZNY
 T91uai0+FxnjCrEIvgL/XxcbSQ3pFXAGwA==
X-Google-Smtp-Source: 
 APXvYqyC8IY1wf+FQl0sd7nckbl5E6rogjsaglrf0jAFQxjlvUp0KNxQzWFnryKtoopwuHR4AZIKVQ==
X-Received: by 2002:a1c:a406:: with SMTP id n6mr4674298wme.40.1579793455559;
 Thu, 23 Jan 2020 07:30:55 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 11/20] target/arm/arch_dump: Add SVE notes
Date: Thu, 23 Jan 2020 15:30:32 +0000
Message-Id: <20200123153041.4248-12-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::32c
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Andrew Jones <drjones@redhat.com>

When dumping a guest with dump-guest-memory also dump the SVE
registers if they are in use.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20200120101832.18781-1-drjones@redhat.com
[PMM: fixed checkpatch nits]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/elf.h          |   1 +
 target/arm/cpu.h       |  25 +++++++++
 target/arm/arch_dump.c | 124 ++++++++++++++++++++++++++++++++++++++++-
 target/arm/kvm64.c     |  24 --------
 4 files changed, 148 insertions(+), 26 deletions(-)

diff --git a/include/elf.h b/include/elf.h
index 3501e0c8d03..8fbfe60e09f 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -1650,6 +1650,7 @@ typedef struct elf64_shdr {
 #define NT_ARM_HW_BREAK 0x402           /* ARM hardware breakpoint registe=
rs */
 #define NT_ARM_HW_WATCH 0x403           /* ARM hardware watchpoint registe=
rs */
 #define NT_ARM_SYSTEM_CALL      0x404   /* ARM system call number */
+#define NT_ARM_SVE      0x405           /* ARM Scalable Vector Extension r=
egs */
=20
 /*
  * Physical entry point into the kernel.
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 40f2c45e17e..c1aedbeac0d 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -980,6 +980,31 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned =
vq);
 void aarch64_sve_change_el(CPUARMState *env, int old_el,
                            int new_el, bool el0_a64);
 void aarch64_add_sve_properties(Object *obj);
+
+/*
+ * SVE registers are encoded in KVM's memory in an endianness-invariant fo=
rmat.
+ * The byte at offset i from the start of the in-memory representation con=
tains
+ * the bits [(7 + 8 * i) : (8 * i)] of the register value. As this means t=
he
+ * lowest offsets are stored in the lowest memory addresses, then that nea=
rly
+ * matches QEMU's representation, which is to use an array of host-endian
+ * uint64_t's, where the lower offsets are at the lower indices. To comple=
te
+ * the translation we just need to byte swap the uint64_t's on big-endian =
hosts.
+ */
+static inline uint64_t *sve_bswap64(uint64_t *dst, uint64_t *src, int nr)
+{
+#ifdef HOST_WORDS_BIGENDIAN
+    int i;
+
+    for (i =3D 0; i < nr; ++i) {
+        dst[i] =3D bswap64(src[i]);
+    }
+
+    return dst;
+#else
+    return src;
+#endif
+}
+
 #else
 static inline void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq) { }
 static inline void aarch64_sve_change_el(CPUARMState *env, int o,
diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c
index 26a2c098687..2345dec3c2c 100644
--- a/target/arm/arch_dump.c
+++ b/target/arm/arch_dump.c
@@ -62,12 +62,23 @@ struct aarch64_user_vfp_state {
=20
 QEMU_BUILD_BUG_ON(sizeof(struct aarch64_user_vfp_state) !=3D 528);
=20
+/* struct user_sve_header from arch/arm64/include/uapi/asm/ptrace.h */
+struct aarch64_user_sve_header {
+    uint32_t size;
+    uint32_t max_size;
+    uint16_t vl;
+    uint16_t max_vl;
+    uint16_t flags;
+    uint16_t reserved;
+} QEMU_PACKED;
+
 struct aarch64_note {
     Elf64_Nhdr hdr;
     char name[8]; /* align_up(sizeof("CORE"), 4) */
     union {
         struct aarch64_elf_prstatus prstatus;
         struct aarch64_user_vfp_state vfp;
+        struct aarch64_user_sve_header sve;
     };
 } QEMU_PACKED;
=20
@@ -76,6 +87,8 @@ struct aarch64_note {
             (AARCH64_NOTE_HEADER_SIZE + sizeof(struct aarch64_elf_prstatus=
))
 #define AARCH64_PRFPREG_NOTE_SIZE \
             (AARCH64_NOTE_HEADER_SIZE + sizeof(struct aarch64_user_vfp_sta=
te))
+#define AARCH64_SVE_NOTE_SIZE(env) \
+            (AARCH64_NOTE_HEADER_SIZE + sve_size(env))
=20
 static void aarch64_note_init(struct aarch64_note *note, DumpState *s,
                               const char *name, Elf64_Word namesz,
@@ -128,11 +141,102 @@ static int aarch64_write_elf64_prfpreg(WriteCoreDump=
Function f,
     return 0;
 }
=20
+#ifdef TARGET_AARCH64
+static off_t sve_zreg_offset(uint32_t vq, int n)
+{
+    off_t off =3D sizeof(struct aarch64_user_sve_header);
+    return ROUND_UP(off, 16) + vq * 16 * n;
+}
+
+static off_t sve_preg_offset(uint32_t vq, int n)
+{
+    return sve_zreg_offset(vq, 32) + vq * 16 / 8 * n;
+}
+
+static off_t sve_fpsr_offset(uint32_t vq)
+{
+    off_t off =3D sve_preg_offset(vq, 17);
+    return ROUND_UP(off, 16);
+}
+
+static off_t sve_fpcr_offset(uint32_t vq)
+{
+    return sve_fpsr_offset(vq) + sizeof(uint32_t);
+}
+
+static uint32_t sve_current_vq(CPUARMState *env)
+{
+    return sve_zcr_len_for_el(env, arm_current_el(env)) + 1;
+}
+
+static size_t sve_size_vq(uint32_t vq)
+{
+    off_t off =3D sve_fpcr_offset(vq) + sizeof(uint32_t);
+    return ROUND_UP(off, 16);
+}
+
+static size_t sve_size(CPUARMState *env)
+{
+    return sve_size_vq(sve_current_vq(env));
+}
+
+static int aarch64_write_elf64_sve(WriteCoreDumpFunction f,
+                                   CPUARMState *env, int cpuid,
+                                   DumpState *s)
+{
+    struct aarch64_note *note;
+    ARMCPU *cpu =3D env_archcpu(env);
+    uint32_t vq =3D sve_current_vq(env);
+    uint64_t tmp[ARM_MAX_VQ * 2], *r;
+    uint32_t fpr;
+    uint8_t *buf;
+    int ret, i;
+
+    note =3D g_malloc0(AARCH64_SVE_NOTE_SIZE(env));
+    buf =3D (uint8_t *)&note->sve;
+
+    aarch64_note_init(note, s, "LINUX", 6, NT_ARM_SVE, sve_size_vq(vq));
+
+    note->sve.size =3D cpu_to_dump32(s, sve_size_vq(vq));
+    note->sve.max_size =3D cpu_to_dump32(s, sve_size_vq(cpu->sve_max_vq));
+    note->sve.vl =3D cpu_to_dump16(s, vq * 16);
+    note->sve.max_vl =3D cpu_to_dump16(s, cpu->sve_max_vq * 16);
+    note->sve.flags =3D cpu_to_dump16(s, 1);
+
+    for (i =3D 0; i < 32; ++i) {
+        r =3D sve_bswap64(tmp, &env->vfp.zregs[i].d[0], vq * 2);
+        memcpy(&buf[sve_zreg_offset(vq, i)], r, vq * 16);
+    }
+
+    for (i =3D 0; i < 17; ++i) {
+        r =3D sve_bswap64(tmp, r =3D &env->vfp.pregs[i].p[0],
+                        DIV_ROUND_UP(vq * 2, 8));
+        memcpy(&buf[sve_preg_offset(vq, i)], r, vq * 16 / 8);
+    }
+
+    fpr =3D cpu_to_dump32(s, vfp_get_fpsr(env));
+    memcpy(&buf[sve_fpsr_offset(vq)], &fpr, sizeof(uint32_t));
+
+    fpr =3D cpu_to_dump32(s, vfp_get_fpcr(env));
+    memcpy(&buf[sve_fpcr_offset(vq)], &fpr, sizeof(uint32_t));
+
+    ret =3D f(note, AARCH64_SVE_NOTE_SIZE(env), s);
+    g_free(note);
+
+    if (ret < 0) {
+        return -1;
+    }
+
+    return 0;
+}
+#endif
+
 int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cs,
                              int cpuid, void *opaque)
 {
     struct aarch64_note note;
-    CPUARMState *env =3D &ARM_CPU(cs)->env;
+    ARMCPU *cpu =3D ARM_CPU(cs);
+    CPUARMState *env =3D &cpu->env;
     DumpState *s =3D opaque;
     uint64_t pstate, sp;
     int ret, i;
@@ -163,7 +267,18 @@ int arm_cpu_write_elf64_note(WriteCoreDumpFunction f, =
CPUState *cs,
         return -1;
     }
=20
-    return aarch64_write_elf64_prfpreg(f, env, cpuid, s);
+    ret =3D aarch64_write_elf64_prfpreg(f, env, cpuid, s);
+    if (ret) {
+        return ret;
+    }
+
+#ifdef TARGET_AARCH64
+    if (cpu_isar_feature(aa64_sve, cpu)) {
+        ret =3D aarch64_write_elf64_sve(f, env, cpuid, s);
+    }
+#endif
+
+    return ret;
 }
=20
 /* struct pt_regs from arch/arm/include/asm/ptrace.h */
@@ -335,6 +450,11 @@ ssize_t cpu_get_note_size(int class, int machine, int =
nr_cpus)
     if (class =3D=3D ELFCLASS64) {
         note_size =3D AARCH64_PRSTATUS_NOTE_SIZE;
         note_size +=3D AARCH64_PRFPREG_NOTE_SIZE;
+#ifdef TARGET_AARCH64
+        if (cpu_isar_feature(aa64_sve, cpu)) {
+            note_size +=3D AARCH64_SVE_NOTE_SIZE(env);
+        }
+#endif
     } else {
         note_size =3D ARM_PRSTATUS_NOTE_SIZE;
         if (arm_feature(env, ARM_FEATURE_VFP)) {
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 876184b8fe4..e2da756e65e 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -876,30 +876,6 @@ static int kvm_arch_put_fpsimd(CPUState *cs)
     return 0;
 }
=20
-/*
- * SVE registers are encoded in KVM's memory in an endianness-invariant fo=
rmat.
- * The byte at offset i from the start of the in-memory representation con=
tains
- * the bits [(7 + 8 * i) : (8 * i)] of the register value. As this means t=
he
- * lowest offsets are stored in the lowest memory addresses, then that nea=
rly
- * matches QEMU's representation, which is to use an array of host-endian
- * uint64_t's, where the lower offsets are at the lower indices. To comple=
te
- * the translation we just need to byte swap the uint64_t's on big-endian =
hosts.
- */
-static uint64_t *sve_bswap64(uint64_t *dst, uint64_t *src, int nr)
-{
-#ifdef HOST_WORDS_BIGENDIAN
-    int i;
-
-    for (i =3D 0; i < nr; ++i) {
-        dst[i] =3D bswap64(src[i]);
-    }
-
-    return dst;
-#else
-    return src;
-#endif
-}
-
 /*
  * KVM SVE registers come in slices where ZREGs have a slice size of 2048 =
bits
  * and PREGS and the FFR have a slice size of 256 bits. However we simply =
hard
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579799666; cv=none;
	d=zohomail.com; s=zohoarc;
	b=fiJlbsx9cdHW6HSGkoFOUSpi5i2kLXBLiwiZpbVbr4ifSBJSykRAt+p0AnxAr6Z2UHngRSUj3HPHydYy5umN8w/g8U7R642KC3SxR+njV37OcMSy3hUoe6x3XHzdb+ftmGBLBLeaepgFlqGlTKTbakaxInWDxtobjpwMb2N/ouY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579799666;
 h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=MnSW5xo5N20Gx6H+HBzm44iLQgb7EW3irvToiBE8BDM=;
	b=KeH6SHpLWyYmzlVj+A66/2ZkjibmwQvpyKscUpfjPcIC7DbN++ItUCzR9eGeE71vH1FDbfBzB8bp/U+EG+dZ6PGE3VZX42kBO+mIbLXPqYIQHF6DlxTM5YtDbyTa9INN6LrS8DhvuxYtI88onGjDbteK/hy1gDjBgbIFUeghJIc=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579799666212899.359219500454;
 Thu, 23 Jan 2020 09:14:26 -0800 (PST)
Received: from localhost ([::1]:33150 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iug3k-0001Tj-FO
	for importer@patchew.org; Thu, 23 Jan 2020 12:14:24 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48412)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRe-0000Pb-Vc
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:00 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRd-0003nH-RL
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:58 -0500
Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54855)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRd-0003m8-JU
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:57 -0500
Received: by mail-wm1-x342.google.com with SMTP id b19so3002121wmj.4
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:57 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.55
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=MnSW5xo5N20Gx6H+HBzm44iLQgb7EW3irvToiBE8BDM=;
 b=fKVr1j4/qHOhAXs/jhgMkCr3gDH+CA68zGDd5BcV4EikQLZCXt1oVGXBBn11bwVjom
 nTLTXvULf+/cH3ql9uKOhiE3CbdpbdQPG00Kxx7gATPMoYuabVxtiTqCnp8lGh5kE2TM
 AFqO6lD+0QdpHUW0yQVMK8XvsvOSMXTqgl3D7BAOH/jrC0Gqok+DLtkylR0D/lUnaoFZ
 IsvUkIu1JgfBn/7xma8QXXlpFvCLQ92ufrmf6N0xJm1LRySkaL6fuaXYKK8yrZbHT2so
 ACen64g7BKfbByzMBa4pKCgLEYU1cPnH3f3mvwwk9Ul1gG0qVd+KLPZdx5W7j7jWEwf7
 2R+g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=MnSW5xo5N20Gx6H+HBzm44iLQgb7EW3irvToiBE8BDM=;
 b=QH2pNdghc33VpiSToD0CMetMy5slL2IrafqqSSvQWneVDb5Yg8Fd1ow86fkZWdY+2M
 e3UlCkCXK6LC3kusyU4yxZT4Mz6uft4GcIKeCG3tjYa+kdMisFcrJMlqgll9sGfCbsJ9
 M89zKYeLLq+R01unV5B55/UjpLSauWQ1ItuY8fV2XgydS0rlFglQRnVzPLT3VWM2lBvn
 kjAYF/aJPY8+4Wvuk9/3JfyGCQjrEjp7K8tayB/cFPcmMCN4PBXZ/aQlEbnbYQLk5c4z
 MXkSrgljI09xno7C1l0N6KYeFunyHotHXrdALjHNWwF2VWceIONSStfTqPajPcm3EYb6
 PmJA==
X-Gm-Message-State: APjAAAUXI13oZbV5EKZKm+r8JLS1MmfTUaQ+bYovcJKYimvt0u0YQCiU
 dIMq3JEiSIGBtGf7LfrVCiG5yuZfUZA1sw==
X-Google-Smtp-Source: 
 APXvYqzCixfzFD6I49MTCfI2NGkimNRMrRXKdUazVsLELL72qRe7Fwhup+rEOaPx8LaJftsVZQfn7Q==
X-Received: by 2002:a05:600c:54c:: with SMTP id
 k12mr4731477wmc.124.1579793456413;
 Thu, 23 Jan 2020 07:30:56 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 12/20] hw/misc/stm32f4xx_syscfg: Fix copy/paste error
Date: Thu, 23 Jan 2020 15:30:33 +0000
Message-Id: <20200123153041.4248-13-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::342
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

From: Philippe Mathieu-Daud=C3=A9 <f4bug@amsat.org>

Missed in 870c034da0b, hopefully reported by Coverity.

Fixes: Coverity CID 1412793 (Incorrect expression)
Signed-off-by: Philippe Mathieu-Daud=C3=A9 <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Alex Benn=C3=A9e <alex.bennee@linaro.org>
Message-id: 20200121213853.9601-1-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/misc/stm32f4xx_syscfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/misc/stm32f4xx_syscfg.c b/hw/misc/stm32f4xx_syscfg.c
index dbcdca59f8e..f960e4ea1ee 100644
--- a/hw/misc/stm32f4xx_syscfg.c
+++ b/hw/misc/stm32f4xx_syscfg.c
@@ -47,7 +47,7 @@ static void stm32f4xx_syscfg_set_irq(void *opaque, int ir=
q, int level)
     STM32F4xxSyscfgState *s =3D opaque;
     int icrreg =3D irq / 4;
     int startbit =3D (irq & 3) * 4;
-    uint8_t config =3D config =3D irq / 16;
+    uint8_t config =3D irq / 16;
=20
     trace_stm32f4xx_syscfg_set_irq(irq / 16, irq % 16, level);
=20
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579802064; cv=none;
	d=zohomail.com; s=zohoarc;
	b=d9jkfTORhar6fE9t17sAhGHufJ4vVNg/S4q3qq5fa52VVPugwPXzCqxskP4qjJQXsR+TZoXWpbBbwlymt2ZltT63LpioBtHhyo7IuU3sjO85gOMY88OLTktMVtnPYe+P6IEnlI8IYtk1gW/pxHcBIO0iHmSBaisga3UdginMh3w=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579802064;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=3M0DtLx0sP95WhjPX2VrG6MMgvUeMRuumjeaeKyOkwk=;
	b=R2UG42QYAv3CgOywt0vC90vYukja5OVCqjdRdOiLdhB4PZhCjmbXpFH5jxpIaCdVbyTZrRPnqZobzIxuUpBcZXYb2QlbrMxy5S8rpxrL1uLNblK6hOirw6gwL1rxOuxiu/YffIN1jqBUoKClf/6oueJmIicso1iDrCsS19LUFKs=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579802064227968.1821252592537;
 Thu, 23 Jan 2020 09:54:24 -0800 (PST)
Received: from localhost ([::1]:34034 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iuggQ-0001NQ-6X
	for importer@patchew.org; Thu, 23 Jan 2020 12:54:22 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48442)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRi-0000So-1y
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRf-0003qM-6v
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:01 -0500
Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:52890)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRe-0003na-Tv
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:59 -0500
Received: by mail-wm1-x32b.google.com with SMTP id p9so3017264wmc.2
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:58 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.56
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=3M0DtLx0sP95WhjPX2VrG6MMgvUeMRuumjeaeKyOkwk=;
 b=BWMqJP9jrHzB7NBokm7LgesFstUO656MIyfeCEFRbY3AAoxxM16ZKBwjXBTVgvviL5
 e8RW9Y6JwBFzeUtkptLPwaqWjasDerg+3GsFX/lCS8dSxCi6jdo459PGqZrTd2V1SA+/
 eHuulrDbUeatUxNySqQD0UHmEllrE7800lzHUof+q5Vdz9c+jG5PLxsRPVlG881M1t5h
 8GkBZlBJNqqCkRj2KaU4H5xE18U78+DKUhY/VHAB8He9R2UX44ykXCaNmINPmaPsHunJ
 5dDi+lQ8Mkq2TnD5iUdUAFEfep95a7KZDMmgc+m5elxbJKyRbwW8n1NGvzvRw1FPCxRG
 ClDg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=3M0DtLx0sP95WhjPX2VrG6MMgvUeMRuumjeaeKyOkwk=;
 b=JCoecvk4XH8Esn9yo+w0gKPR2uCsJbj+xn0VNNTMtiemvoM28yfV7F6ap39ZxtzZuh
 f2qiVJcGUlyozhYzkcpQWrT22XCj3OmGQGKmFs5p9gzgnu4ZMFg5y5OvwmdTnuQDCTmd
 KMZ5bLOSa8YSR9Yg4Sj0NClqQXPe9tLB/tZX3eoUYJV/y2cnOBT14bwp3EdiUmU0E1xw
 GqERZ4wvgqrgCjQzcJA6vdxrulpPjE50cOuxcEt7lsV71VToZIVkfKxeFPb9787xLf+P
 WteB/Sr9dezH6NWAY1yObg/hghIGX4Q7Tq4HYS3dNV7/Y9p/1JeZMa5xCez1dx5/3w6T
 3tkw==
X-Gm-Message-State: APjAAAUuep8E8gIF+ziO78Ex1T/O6z9JXD5u9aalssB1v+GHtogSCgP5
 RvhC1zRhVtE2sHfhLDD/ultvKg/2XWndRw==
X-Google-Smtp-Source: 
 APXvYqwM3ZAS8KIB4Wrk2MAKdu75PKobP8/Fqa+gKdJTsqVFU0jzAeu5F8DKODfSZjHagYUJmS3maw==
X-Received: by 2002:a1c:b7c4:: with SMTP id
 h187mr5029505wmf.105.1579793457540;
 Thu, 23 Jan 2020 07:30:57 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 13/20] dma/pl330: Convert to support tracing
Date: Thu, 23 Jan 2020 15:30:34 +0000
Message-Id: <20200123153041.4248-14-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::32b
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

Replace debug logging code with tracing.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-2-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/dma/pl330.c      | 88 ++++++++++++++++++++++++---------------------
 hw/dma/trace-events | 24 +++++++++++++
 2 files changed, 72 insertions(+), 40 deletions(-)

diff --git a/hw/dma/pl330.c b/hw/dma/pl330.c
index f2bb2d9ac16..64519971ef9 100644
--- a/hw/dma/pl330.c
+++ b/hw/dma/pl330.c
@@ -25,19 +25,12 @@
 #include "sysemu/dma.h"
 #include "qemu/log.h"
 #include "qemu/module.h"
+#include "trace.h"
=20
 #ifndef PL330_ERR_DEBUG
 #define PL330_ERR_DEBUG 0
 #endif
=20
-#define DB_PRINT_L(lvl, fmt, args...) do {\
-    if (PL330_ERR_DEBUG >=3D lvl) {\
-        fprintf(stderr, "PL330: %s:" fmt, __func__, ## args);\
-    } \
-} while (0)
-
-#define DB_PRINT(fmt, args...) DB_PRINT_L(1, fmt, ## args)
-
 #define PL330_PERIPH_NUM            32
 #define PL330_MAX_BURST_LEN         128
 #define PL330_INSN_MAXSIZE          6
@@ -319,6 +312,26 @@ typedef struct PL330InsnDesc {
     void (*exec)(PL330Chan *, uint8_t opcode, uint8_t *args, int len);
 } PL330InsnDesc;
=20
+static void pl330_hexdump(uint8_t *buf, size_t size)
+{
+    unsigned int b, i, len;
+    char tmpbuf[80];
+
+    for (b =3D 0; b < size; b +=3D 16) {
+        len =3D size - b;
+        if (len > 16) {
+            len =3D 16;
+        }
+        tmpbuf[0] =3D '\0';
+        for (i =3D 0; i < len; i++) {
+            if ((i % 4) =3D=3D 0) {
+                strcat(tmpbuf, " ");
+            }
+            sprintf(tmpbuf + strlen(tmpbuf), " %02x", buf[b + i]);
+        }
+        trace_pl330_hexdump(b, tmpbuf);
+    }
+}
=20
 /* MFIFO Implementation
  *
@@ -582,7 +595,7 @@ static inline void pl330_queue_remove_tagged(PL330Queue=
 *s, uint8_t tag)
=20
 static inline void pl330_fault(PL330Chan *ch, uint32_t flags)
 {
-    DB_PRINT("ch: %p, flags: %" PRIx32 "\n", ch, flags);
+    trace_pl330_fault(ch, flags);
     ch->fault_type |=3D flags;
     if (ch->state =3D=3D pl330_chan_fault) {
         return;
@@ -590,7 +603,7 @@ static inline void pl330_fault(PL330Chan *ch, uint32_t =
flags)
     ch->state =3D pl330_chan_fault;
     ch->parent->num_faulting++;
     if (ch->parent->num_faulting =3D=3D 1) {
-        DB_PRINT("abort interrupt raised\n");
+        trace_pl330_fault_abort();
         qemu_irq_raise(ch->parent->irq_abort);
     }
 }
@@ -648,7 +661,7 @@ static void pl330_dmaend(PL330Chan *ch, uint8_t opcode,
             return;
         }
     }
-    DB_PRINT("DMA ending!\n");
+    trace_pl330_dmaend();
     pl330_fifo_tagged_remove(&s->fifo, ch->tag);
     pl330_queue_remove_tagged(&s->read_queue, ch->tag);
     pl330_queue_remove_tagged(&s->write_queue, ch->tag);
@@ -683,7 +696,7 @@ static void pl330_dmago(PL330Chan *ch, uint8_t opcode, =
uint8_t *args, int len)
     uint32_t pc;
     PL330Chan *s;
=20
-    DB_PRINT("\n");
+    trace_pl330_dmago();
=20
     if (!ch->is_manager) {
         pl330_fault(ch, PL330_FAULT_UNDEF_INSTR);
@@ -740,9 +753,7 @@ static void pl330_dmald(PL330Chan *ch, uint8_t opcode, =
uint8_t *args, int len)
     ch->stall =3D pl330_queue_put_insn(&ch->parent->read_queue, ch->src,
                                     size, num, inc, 0, ch->tag);
     if (!ch->stall) {
-        DB_PRINT("channel:%" PRId8 " address:%08" PRIx32 " size:%" PRIx32
-                 " num:%" PRId32 " %c\n",
-                 ch->tag, ch->src, size, num, inc ? 'Y' : 'N');
+        trace_pl330_dmald(ch->tag, ch->src, size, num, inc ? 'Y' : 'N');
         ch->src +=3D inc ? size * num - (ch->src & (size - 1)) : 0;
     }
 }
@@ -782,7 +793,7 @@ static void pl330_dmakill(PL330Chan *ch, uint8_t opcode=
, uint8_t *args, int len)
         ch->fault_type =3D 0;
         ch->parent->num_faulting--;
         if (ch->parent->num_faulting =3D=3D 0) {
-            DB_PRINT("abort interrupt lowered\n");
+            trace_pl330_dmakill();
             qemu_irq_lower(ch->parent->irq_abort);
         }
     }
@@ -800,6 +811,8 @@ static void pl330_dmalpend(PL330Chan *ch, uint8_t opcod=
e,
     uint8_t bs =3D opcode & 3;
     uint8_t lc =3D (opcode & 4) >> 2;
=20
+    trace_pl330_dmalpend(nf, bs, lc, ch->lc[lc], ch->request_flag);
+
     if (bs =3D=3D 2) {
         pl330_fault(ch, PL330_FAULT_OPERAND_INVALID);
         return;
@@ -813,12 +826,12 @@ static void pl330_dmalpend(PL330Chan *ch, uint8_t opc=
ode,
         if (nf) {
             ch->lc[lc]--;
         }
-        DB_PRINT("loop reiteration\n");
+        trace_pl330_dmalpiter();
         ch->pc -=3D args[0];
         ch->pc -=3D len + 1;
         /* "ch->pc -=3D args[0] + len + 1" is incorrect when args[0] =3D=
=3D 256 */
     } else {
-        DB_PRINT("loop fallthrough\n");
+        trace_pl330_dmalpfallthrough();
     }
 }
=20
@@ -886,10 +899,10 @@ static void pl330_dmasev(PL330Chan *ch, uint8_t opcod=
e, uint8_t *args, int len)
     }
     if (ch->parent->inten & (1 << ev_id)) {
         ch->parent->int_status |=3D (1 << ev_id);
-        DB_PRINT("event interrupt raised %" PRId8 "\n", ev_id);
+        trace_pl330_dmasev_evirq(ev_id);
         qemu_irq_raise(ch->parent->irq[ev_id]);
     }
-    DB_PRINT("event raised %" PRId8 "\n", ev_id);
+    trace_pl330_dmasev_event(ev_id);
     ch->parent->ev_status |=3D (1 << ev_id);
 }
=20
@@ -914,9 +927,7 @@ static void pl330_dmast(PL330Chan *ch, uint8_t opcode, =
uint8_t *args, int len)
     ch->stall =3D pl330_queue_put_insn(&ch->parent->write_queue, ch->dst,
                                     size, num, inc, 0, ch->tag);
     if (!ch->stall) {
-        DB_PRINT("channel:%" PRId8 " address:%08" PRIx32 " size:%" PRIx32
-                 " num:%" PRId32 " %c\n",
-                 ch->tag, ch->dst, size, num, inc ? 'Y' : 'N');
+        trace_pl330_dmast(ch->tag, ch->dst, size, num, inc ? 'Y' : 'N');
         ch->dst +=3D inc ? size * num - (ch->dst & (size - 1)) : 0;
     }
 }
@@ -992,7 +1003,7 @@ static void pl330_dmawfe(PL330Chan *ch, uint8_t opcode,
             }
         }
         ch->parent->ev_status &=3D ~(1 << ev_id);
-        DB_PRINT("event lowered %" PRIx8 "\n", ev_id);
+        trace_pl330_dmawfe(ev_id);
     } else {
         ch->stall =3D 1;
     }
@@ -1135,7 +1146,7 @@ static int pl330_chan_exec(PL330Chan *ch)
     ch->stall =3D 0;
     insn =3D pl330_fetch_insn(ch);
     if (!insn) {
-        DB_PRINT("pl330 undefined instruction\n");
+        trace_pl330_chan_exec_undef();
         pl330_fault(ch, PL330_FAULT_UNDEF_INSTR);
         return 0;
     }
@@ -1175,10 +1186,9 @@ static int pl330_exec_cycle(PL330Chan *channel)
         int len =3D q->len - (q->addr & (q->len - 1));
=20
         dma_memory_read(&address_space_memory, q->addr, buf, len);
-        if (PL330_ERR_DEBUG > 1) {
-            DB_PRINT("PL330 read from memory @%08" PRIx32 " (size =3D %08x=
):\n",
-                      q->addr, len);
-            qemu_hexdump((char *)buf, stderr, "", len);
+        trace_pl330_exec_cycle(q->addr, len);
+        if (trace_event_get_state_backends(TRACE_PL330_HEXDUMP)) {
+            pl330_hexdump(buf, len);
         }
         fifo_res =3D pl330_fifo_push(&s->fifo, buf, len, q->tag);
         if (fifo_res =3D=3D PL330_FIFO_OK) {
@@ -1207,10 +1217,9 @@ static int pl330_exec_cycle(PL330Chan *channel)
         }
         if (fifo_res =3D=3D PL330_FIFO_OK || q->z) {
             dma_memory_write(&address_space_memory, q->addr, buf, len);
-            if (PL330_ERR_DEBUG > 1) {
-                DB_PRINT("PL330 read from memory @%08" PRIx32
-                         " (size =3D %08x):\n", q->addr, len);
-                qemu_hexdump((char *)buf, stderr, "", len);
+            trace_pl330_exec_cycle(q->addr, len);
+            if (trace_event_get_state_backends(TRACE_PL330_HEXDUMP)) {
+                pl330_hexdump(buf, len);
             }
             if (q->inc) {
                 q->addr +=3D len;
@@ -1252,8 +1261,8 @@ static int pl330_exec_channel(PL330Chan *channel)
=20
 static inline void pl330_exec(PL330State *s)
 {
-    DB_PRINT("\n");
     int i, insr_exec;
+    trace_pl330_exec();
     do {
         insr_exec =3D pl330_exec_channel(&s->manager);
=20
@@ -1298,7 +1307,7 @@ static void pl330_debug_exec(PL330State *s)
     args[2] =3D (s->dbg[1] >>  8) & 0xff;
     args[3] =3D (s->dbg[1] >> 16) & 0xff;
     args[4] =3D (s->dbg[1] >> 24) & 0xff;
-    DB_PRINT("chan id: %" PRIx8 "\n", chan_id);
+    trace_pl330_debug_exec(chan_id);
     if (s->dbg[0] & 1) {
         ch =3D &s->chan[chan_id];
     } else {
@@ -1320,6 +1329,7 @@ static void pl330_debug_exec(PL330State *s)
         ch->fault_type |=3D PL330_FAULT_DBG_INSTR;
     }
     if (ch->stall) {
+        trace_pl330_debug_exec_stall();
         qemu_log_mask(LOG_UNIMP, "pl330: stall of debug instruction not "
                       "implemented\n");
     }
@@ -1334,7 +1344,7 @@ static void pl330_iomem_write(void *opaque, hwaddr of=
fset,
     PL330State *s =3D (PL330State *) opaque;
     int i;
=20
-    DB_PRINT("addr: %08x data: %08x\n", (unsigned)offset, (unsigned)value);
+    trace_pl330_iomem_write((unsigned)offset, (unsigned)value);
=20
     switch (offset) {
     case PL330_REG_INTEN:
@@ -1343,7 +1353,7 @@ static void pl330_iomem_write(void *opaque, hwaddr of=
fset,
     case PL330_REG_INTCLR:
         for (i =3D 0; i < s->num_events; i++) {
             if (s->int_status & s->inten & value & (1 << i)) {
-                DB_PRINT("event interrupt lowered %d\n", i);
+                trace_pl330_iomem_write_clr(i);
                 qemu_irq_lower(s->irq[i]);
             }
         }
@@ -1361,11 +1371,9 @@ static void pl330_iomem_write(void *opaque, hwaddr o=
ffset,
         }
         break;
     case PL330_REG_DBGINST0:
-        DB_PRINT("s->dbg[0] =3D %08x\n", (unsigned)value);
         s->dbg[0] =3D value;
         break;
     case PL330_REG_DBGINST1:
-        DB_PRINT("s->dbg[1] =3D %08x\n", (unsigned)value);
         s->dbg[1] =3D value;
         break;
     default:
@@ -1489,7 +1497,7 @@ static uint64_t pl330_iomem_read(void *opaque, hwaddr=
 offset,
         unsigned size)
 {
     uint32_t ret =3D pl330_iomem_read_imp(opaque, offset);
-    DB_PRINT("addr: %08" HWADDR_PRIx " data: %08" PRIx32 "\n", offset, ret=
);
+    trace_pl330_iomem_read((uint32_t)offset, ret);
     return ret;
 }
=20
diff --git a/hw/dma/trace-events b/hw/dma/trace-events
index e4498428c52..5902ac5969d 100644
--- a/hw/dma/trace-events
+++ b/hw/dma/trace-events
@@ -20,3 +20,27 @@ sparc32_dma_enable_lower(void) "Lower DMA enable"
=20
 # i8257.c
 i8257_unregistered_dma(int nchan, int dma_pos, int dma_len) "unregistered =
DMA channel used nchan=3D%d dma_pos=3D%d dma_len=3D%d"
+
+# pl330.c
+pl330_fault(void *ptr, uint32_t flags) "ch: %p, flags: 0x%"PRIx32
+pl330_fault_abort(void) "abort interrupt raised"
+pl330_dmaend(void) "DMA ending"
+pl330_dmago(void) "DMA run"
+pl330_dmald(uint32_t chan, uint32_t addr, uint32_t size, uint32_t num, uin=
t32_t ch) "channel:%"PRId8" address:0x%08"PRIx32" size:0x%"PRIx32" num:%"PR=
Id32"%c"
+pl330_dmakill(void) "abort interrupt lowered"
+pl330_dmalpend(uint8_t nf, uint8_t bs, uint8_t lc, uint8_t ch, uint8_t fla=
g) "nf=3D0x%02x bs=3D0x%02x lc=3D0x%02x ch=3D0x%02x flag=3D0x%02x"
+pl330_dmalpiter(void) "loop reiteration"
+pl330_dmalpfallthrough(void) "loop fallthrough"
+pl330_dmasev_evirq(uint8_t ev_id) "event interrupt raised %"PRId8
+pl330_dmasev_event(uint8_t ev_id) "event raised %"PRId8
+pl330_dmast(uint32_t chn, uint32_t addr, uint32_t sz, uint32_t num, uint32=
_t c) "channel:%"PRId8" address:0x%08"PRIx32" size:0x%"PRIx32" num:%"PRId32=
" %c"
+pl330_dmawfe(uint8_t ev_id) "event lowered 0x%"PRIx8
+pl330_chan_exec_undef(void) "undefined instruction"
+pl330_exec_cycle(uint32_t addr, uint32_t size) "PL330 read from memory @0x=
%08"PRIx32" (size =3D 0x%08"PRIx32")"
+pl330_hexdump(uint32_t offset, char *str) " 0x%04"PRIx32":%s"
+pl330_exec(void) "pl330_exec"
+pl330_debug_exec(uint8_t ch) "chan id: 0x%"PRIx8
+pl330_debug_exec_stall(void) "stall of debug instruction not implemented"
+pl330_iomem_write(uint32_t offset, uint32_t value) "addr: 0x%08"PRIx32" da=
ta: 0x%08"PRIx32
+pl330_iomem_write_clr(int i) "event interrupt lowered %d"
+pl330_iomem_read(uint32_t addr, uint32_t data) "addr: 0x%08"PRIx32" data: =
0x%08"PRIx32
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579799893; cv=none;
	d=zohomail.com; s=zohoarc;
	b=cq3lcIIcHSLgGOM0fkayasOOnizNbztmKxrb8YD+Qdzx6ykMPFkL/8flXhX+jGZrXNJ70BXwSwNe0misiTR5C9mn2imcsFz3kZUiWVJoQX2f0Ub1YiscEijvef+9dSVYr4eAyKKOBInZbc02us26eU10obwNCZnbvS9g3hIdDmw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579799893;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=TNju8K/yY0mIPA9rZ4WT+1GVvRX99QV39SbRPGh2iCg=;
	b=Z499uhq4BU8XB4zyBpsUD3++i6apSjt9lXsfDXZ0+wj21nFbk7JwsAE5qnMKVme5beG1OCYNCgBuMO2sEuH03OiK8OqjbjGF2mDBVskorhArg0j16NeQDSyc1uq8eHY/zeQ98MHMMD3GEAjoLLN3Qj5W46FmQuv02kR2a7qeXxw=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579799893120810.4204644077026;
 Thu, 23 Jan 2020 09:18:13 -0800 (PST)
Received: from localhost ([::1]:33210 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iug7P-0005AF-2L
	for importer@patchew.org; Thu, 23 Jan 2020 12:18:11 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48443)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRi-0000Sp-2C
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRf-0003ru-Vh
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:01 -0500
Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:40744)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRf-0003pz-Ln
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:30:59 -0500
Received: by mail-wm1-x331.google.com with SMTP id t14so2967201wmi.5
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:30:59 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.57
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:57 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=TNju8K/yY0mIPA9rZ4WT+1GVvRX99QV39SbRPGh2iCg=;
 b=GD1rVnsbRyIOZi0HqoCML49dPwoQnKcV4zlem9zySe8bqOuQo6e2boRwmZu/7Bvt7i
 aXQaas2Of2EJ2GHL9pMiFscFOFGaKVJkRC1I2IP+qnWjAsaOAcEyy3/C154icX/0aHRR
 14sSwaFilnxBNpIWelG5sAebw54kKgS57/oXXyy5qrfuuCEe1Nmbhhs5eZ+e/PryUV2d
 WeZHULDahxp0j4fc9B99Z3xlhKL19sFjSVbSUeN9YfBwAzXN7NFu+E1DlrR5/7I0ywww
 CUIRpXAIghaFFmCvi3brOdwYB0bK4rbsVzT7U3HleEQ9XE+0ccvArLwZvGX9eQ4oH+H7
 uYqg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=TNju8K/yY0mIPA9rZ4WT+1GVvRX99QV39SbRPGh2iCg=;
 b=sDvKJ48Q/HKnzKnjUpaVeQQBy6qz2pEHtZdIcYs/YY3I1Nmt6HoTyrzQxjmfSMvf70
 vxs4UoDZfgh5Mkpc8y31SFoIIX6larf+dGQdLFVGust6MVKFimT/YryGB/Rx8AiAFxGN
 KgsysCSUeWxtMXz94CBaX+2sAsm9EIKaoXWNr+La3JVRNwushPsdfOADMZSirTSZvM1H
 Ycpf3iSKLXTf4Tq38B67YJREXQlwikGyFvvGWsI3LLDHz1VkPbseoKbHuDtDmoFZZNJS
 oGHudBHcVNDIjNA3dGLCNwwddiCgjrK2zrUyb+1BFgdXS9CM033VEhhmvf6HYbW3xgAO
 zfXw==
X-Gm-Message-State: APjAAAUHv+tGSvJ7HOMEXFx1plX6PflZkaSyQAFj8977IwWf6wLqhKok
 MQNgqz9VU2vFauhUY3FpbrO3L+GOnmM2lA==
X-Google-Smtp-Source: 
 APXvYqyFRUe78zxuF+swfVJ10V44YwQRe6j/FnsPv8AT+UCZATYaIskXFxC2Vnxu7GW/26t4jsaGBQ==
X-Received: by 2002:a7b:c1c7:: with SMTP id a7mr4719422wmj.168.1579793458447;
 Thu, 23 Jan 2020 07:30:58 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 14/20] hw/core/or-irq: Increase limit of or-lines to 48
Date: Thu, 23 Jan 2020 15:30:35 +0000
Message-Id: <20200123153041.4248-15-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::331
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

Exynos DMA requires up to 33 interrupt lines (32 event interrupts
plus abort interrupt), which all need to be wired together. Increase
the maximum number of or-irq lines to 48 to support this configuration.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-3-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/hw/or-irq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/or-irq.h b/include/hw/or-irq.h
index 3a3230dd844..0038bfbe3d6 100644
--- a/include/hw/or-irq.h
+++ b/include/hw/or-irq.h
@@ -33,7 +33,7 @@
 /* This can safely be increased if necessary without breaking
  * migration compatibility (as long as it remains greater than 15).
  */
-#define MAX_OR_LINES      32
+#define MAX_OR_LINES      48
=20
 typedef struct OrIRQState qemu_or_irq;
=20
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579804054; cv=none;
	d=zohomail.com; s=zohoarc;
	b=jm8x/ojTMauAO9QHp+QQ5VfLQwCkhUdtaK7XpbgVneb1QPxXP6NSIsGY5SH4JyHuJupxgwAud2R7JCBEQueomBoeCW6xCJcUyFFu85/hJy9xmmwupt+NH70B1xJwZdSn2fwEIaRUlGuzzXMe/HPKIZzRD4ecgApW0RjSQlNz4O8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579804054;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=A4I+VF355k3jsisxBlTLttI/lpdyrdQbQaCIU3RplcU=;
	b=nfziEpyBi9JrVBFuPczsXpYuq+8u3nMFO5eRcrGAi5S8MgincQR5YR9F0o+mH+ULXMHoxuJvT9qJK40VKxLpAvBiqzwPEUk8f/BJeOUU18FD07CJcUEYe/sbr64HOc0W7bs4+Vumv8UBFj4RzOGsddOybPyQZPQdJF+SLQn1EtY=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579804054709975.5670153419682;
 Thu, 23 Jan 2020 10:27:34 -0800 (PST)
Received: from localhost ([::1]:34726 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iuhCX-0003ed-5R
	for importer@patchew.org; Thu, 23 Jan 2020 13:27:33 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48478)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRl-0000Uy-KF
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:07 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRj-0003xP-QE
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:05 -0500
Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:50270)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRh-0003s1-VG
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:02 -0500
Received: by mail-wm1-x332.google.com with SMTP id a5so3022696wmb.0
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:31:00 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.58
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:58 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=A4I+VF355k3jsisxBlTLttI/lpdyrdQbQaCIU3RplcU=;
 b=aTSpFQt//TWlyU8KeQC3749oyZfVDTA2S5ScqKqENlPeKu+0cxq+j/js/radwKcAW1
 qs/oBaM5sDd/NGDQ6Gns2YGr2ZsL66LclYgTAGT6PfFFJI5RgdNP5bEkF2q+xKrpu+jx
 iPmtcqaXOSDzJRnvXrJF4L9mpgt8nW3bvRYv2xmFyU/aBWqd6guq3D9/Nc6sB9XpD2dl
 P/MLFttz5bfLvX0O6bI9aaXMx3qNZmHLYObCba2B/Ebqd9zbcMCHk2DL78ExeCipiQF9
 FJkPnPG3PFYbsjEtkmkhY8ONyIpkVwAi5AtzVCjtc7XLx4ByH51bmbykIFpUz71zh+ei
 tVzQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=A4I+VF355k3jsisxBlTLttI/lpdyrdQbQaCIU3RplcU=;
 b=mDk+R4T86tPMqxn66SypViUaPUEpUpJL2++0CvRU32F/m+UyqmWdTDN8TTbIeF0BcV
 Vojfi6XFsMLFwXsm/SZua6qZhadS7IXQVYL29+a8lNSSUkF4JAWzgcUa0oO78NSd+lKj
 V6P/tac66QfT+Mj7GVOOoSYi55JOlyzxF48xgQVKxvFM/OARrArj3YjunCH0zk7fUnCK
 7uXShbgbWGAhO1+RiKLMZVxIapCATBS07BmM+GA5Nn/SnqjTzgNCs8RjRpIIb+Ec8D47
 NcgSOzBvLMa+kxPSG+drwJVUTmiCISKVzJ+MoKT5HdUPAxqymj2pjb2tgda1ILqTuhOi
 1cYA==
X-Gm-Message-State: APjAAAXFfE6JdsSHbVNqmQyjDc2hYktnCQZfyr4V9dGz5pkK7SwUA6yI
 SbngBfPE3tGaqJ4SNPV0qTy9QXxHGMqLuA==
X-Google-Smtp-Source: 
 APXvYqyNgbM8e289MTVorCCIZhxXEfTlHiKlL4znNHSANU1FfnC1rVzc1GB1OLVYGWfVt2xo+FIc0w==
X-Received: by 2002:a1c:3d8b:: with SMTP id
 k133mr4720186wma.161.1579793459370;
 Thu, 23 Jan 2020 07:30:59 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 15/20] hw/arm/exynos4210: Fix DMA initialization
Date: Thu, 23 Jan 2020 15:30:36 +0000
Message-Id: <20200123153041.4248-16-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::332
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

First parameter to exynos4210_get_irq() is not the SPI port number,
but the interrupt group number. Interrupt groups are 20 for mdma
and 21 for pdma. Interrupts are not inverted. Controllers support 32
events (pdma) or 31 events (mdma). Events must all be routed to a single
interrupt line. Set other parameters as documented in Exynos4210 datasheet,
section 8 (DMA controller).

Fixes: 59520dc65e ("hw/arm/exynos4210: Add DMA support for the Exynos4210")
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-4-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/hw/arm/exynos4210.h |  4 +++
 hw/arm/exynos4210.c         | 51 +++++++++++++++++++++++++++++++------
 2 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h
index f0f23b0e9b2..55260394af6 100644
--- a/include/hw/arm/exynos4210.h
+++ b/include/hw/arm/exynos4210.h
@@ -24,6 +24,7 @@
 #ifndef EXYNOS4210_H
 #define EXYNOS4210_H
=20
+#include "hw/or-irq.h"
 #include "hw/sysbus.h"
 #include "target/arm/cpu-qom.h"
=20
@@ -74,6 +75,8 @@
=20
 #define EXYNOS4210_I2C_NUMBER               9
=20
+#define EXYNOS4210_NUM_DMA      3
+
 typedef struct Exynos4210Irq {
     qemu_irq int_combiner_irq[EXYNOS4210_MAX_INT_COMBINER_IN_IRQ];
     qemu_irq ext_combiner_irq[EXYNOS4210_MAX_EXT_COMBINER_IN_IRQ];
@@ -97,6 +100,7 @@ typedef struct Exynos4210State {
     MemoryRegion boot_secondary;
     MemoryRegion bootreg_mem;
     I2CBus *i2c_if[EXYNOS4210_I2C_NUMBER];
+    qemu_or_irq pl330_irq_orgate[EXYNOS4210_NUM_DMA];
 } Exynos4210State;
=20
 #define TYPE_EXYNOS4210_SOC "exynos4210"
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index 77fbe1baabc..7701a3fa8bd 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -166,17 +166,36 @@ static uint64_t exynos4210_calc_affinity(int cpu)
     return (0x9 << ARM_AFF1_SHIFT) | cpu;
 }
=20
-static void pl330_create(uint32_t base, qemu_irq irq, int nreq)
+static void pl330_create(uint32_t base, qemu_or_irq *orgate, qemu_irq irq,
+                         int nreq, int nevents, int width)
 {
     SysBusDevice *busdev;
     DeviceState *dev;
+    int i;
=20
     dev =3D qdev_create(NULL, "pl330");
+    qdev_prop_set_uint8(dev, "num_events", nevents);
+    qdev_prop_set_uint8(dev, "num_chnls",  8);
     qdev_prop_set_uint8(dev, "num_periph_req",  nreq);
+
+    qdev_prop_set_uint8(dev, "wr_cap", 4);
+    qdev_prop_set_uint8(dev, "wr_q_dep", 8);
+    qdev_prop_set_uint8(dev, "rd_cap", 4);
+    qdev_prop_set_uint8(dev, "rd_q_dep", 8);
+    qdev_prop_set_uint8(dev, "data_width", width);
+    qdev_prop_set_uint16(dev, "data_buffer_dep", width);
     qdev_init_nofail(dev);
     busdev =3D SYS_BUS_DEVICE(dev);
     sysbus_mmio_map(busdev, 0, base);
-    sysbus_connect_irq(busdev, 0, irq);
+
+    object_property_set_int(OBJECT(orgate), nevents + 1, "num-lines",
+                            &error_abort);
+    object_property_set_bool(OBJECT(orgate), true, "realized", &error_abor=
t);
+
+    for (i =3D 0; i < nevents + 1; i++) {
+        sysbus_connect_irq(busdev, i, qdev_get_gpio_in(DEVICE(orgate), i));
+    }
+    qdev_connect_gpio_out(DEVICE(orgate), 0, irq);
 }
=20
 static void exynos4210_realize(DeviceState *socdev, Error **errp)
@@ -431,12 +450,27 @@ static void exynos4210_realize(DeviceState *socdev, E=
rror **errp)
             s->irq_table[exynos4210_get_irq(28, 3)]);
=20
     /*** DMA controllers ***/
-    pl330_create(EXYNOS4210_PL330_BASE0_ADDR,
-                 qemu_irq_invert(s->irq_table[exynos4210_get_irq(35, 1)]),=
 32);
-    pl330_create(EXYNOS4210_PL330_BASE1_ADDR,
-                 qemu_irq_invert(s->irq_table[exynos4210_get_irq(36, 1)]),=
 32);
-    pl330_create(EXYNOS4210_PL330_BASE2_ADDR,
-                 qemu_irq_invert(s->irq_table[exynos4210_get_irq(34, 1)]),=
 1);
+    pl330_create(EXYNOS4210_PL330_BASE0_ADDR, &s->pl330_irq_orgate[0],
+                 s->irq_table[exynos4210_get_irq(21, 0)], 32, 32, 32);
+    pl330_create(EXYNOS4210_PL330_BASE1_ADDR, &s->pl330_irq_orgate[1],
+                 s->irq_table[exynos4210_get_irq(21, 1)], 32, 32, 32);
+    pl330_create(EXYNOS4210_PL330_BASE2_ADDR, &s->pl330_irq_orgate[2],
+                 s->irq_table[exynos4210_get_irq(20, 1)], 1, 31, 64);
+}
+
+static void exynos4210_init(Object *obj)
+{
+    Exynos4210State *s =3D EXYNOS4210_SOC(obj);
+    int i;
+
+    for (i =3D 0; i < ARRAY_SIZE(s->pl330_irq_orgate); i++) {
+        char *name =3D g_strdup_printf("pl330-irq-orgate%d", i);
+        qemu_or_irq *orgate =3D &s->pl330_irq_orgate[i];
+
+        object_initialize_child(obj, name, orgate, sizeof(*orgate),
+                                TYPE_OR_IRQ, &error_abort, NULL);
+        g_free(name);
+    }
 }
=20
 static void exynos4210_class_init(ObjectClass *klass, void *data)
@@ -450,6 +484,7 @@ static const TypeInfo exynos4210_info =3D {
     .name =3D TYPE_EXYNOS4210_SOC,
     .parent =3D TYPE_SYS_BUS_DEVICE,
     .instance_size =3D sizeof(Exynos4210State),
+    .instance_init =3D exynos4210_init,
     .class_init =3D exynos4210_class_init,
 };
=20
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579801841; cv=none;
	d=zohomail.com; s=zohoarc;
	b=BMZ1mzy0wT5lpal3wJ/N9AXbjG6VTgdKAcRA2/URUySAz81Qk5yw6cKxGpdkMjurFDBcV0LgakiYl3u2v0f+tmghSwHEyJLrYPUGGxoe3cXXCFdhalPpn/BFw5oD5ceq58Ge2VUsE6NytG+QaEACwcDlUGqflZFkSF97HWOD2mY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579801841;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=2mI/EOAKFi7f/eA2+s7J/J9un9r8CN/tUEvUeiWqW7U=;
	b=TttwKTnVdqWk0kYWtlPbgTK6adiQnx3U3+ukjVoja4diETpbcCDbdTOMeOXTkXLekksLcfaYr+v9p+GaYvT0opAE3Ztyh6zshfgNlIpF6T8bhZwqRWvFRv0OoewUcKt3lyimiPKZdBBc0vDDfPa9N3sZQGWaWjQeXD2MZXg/MAM=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579801841784614.6000972334791;
 Thu, 23 Jan 2020 09:50:41 -0800 (PST)
Received: from localhost ([::1]:33968 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugcp-0005M0-Tz
	for importer@patchew.org; Thu, 23 Jan 2020 12:50:39 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48479)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRl-0000Uz-KZ
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRj-0003xX-Qq
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:05 -0500
Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:39390)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRi-0003uI-Ps
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:03 -0500
Received: by mail-wm1-x343.google.com with SMTP id 20so2961679wmj.4
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:31:01 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.30.59
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:30:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=2mI/EOAKFi7f/eA2+s7J/J9un9r8CN/tUEvUeiWqW7U=;
 b=NIsnKYpuXWwZncUD1ENk8RtMdeM8jAcT0C0h9Z5PBqaaw0qcRIHx+jR0zC6cPQYqYr
 sc9pWkaVQ50WCq6n0DvZFIrpTHuj9ZCzoczotDgDaasYlIMOMM9B730mBuHauG7kQaaw
 u887w4SEzGsWSdFiXjglk1behc/nvlN+Xshq0Azia3LgTe5cWfUIOvXcNsFdhMTO+XWe
 z7Nq2TMfoqy3rYU1tHG6t3L9OzT2lazFcGXJMKyzl4XsNwOWb/lZDB4jmasN8CyLwpQ9
 HT4fXXio65EMPh1tMpNyElLGqmFhKqwe5Ju3E3ESkuAtW5LDzU5HaJ17XtDgkSIUYoHA
 rb1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=2mI/EOAKFi7f/eA2+s7J/J9un9r8CN/tUEvUeiWqW7U=;
 b=B/xDaX0ojXr9jJ9x+8U+s1lFka5JZczVSAsUJ8aDUjRKZWNQxkeSyGyXDULvPzG5I6
 EJfRnaHpxbVufGVtlFDzdQ14gmyd9A7JfY70za4J/NJX1GUDxIAWQVFxLaNOswnDCVy9
 cQ5T8EJrk9PmpHsbESlPfhOGE5M64PI7xHlyiWPqV1vA/5WY6eLHpq/OHHnEuzh+qlLY
 Vn5BW/EfQIWpOoGkpEz/3rk3yYRikEt+FjhQ3yoNHObvmAYtpdV6ZmAgRBVVjyy53FPv
 zonH7Y1ounpRAgVQ/RxY8LzKtpfX1lJC4p6Rp/bxnAELxJKbn2wE7zMxyVqVVFFT2y8U
 QLhA==
X-Gm-Message-State: APjAAAU5vdeXGYQXnbiEoWzAr2/J97gGJ0eVUVfIei6LdpR5sLINCQpJ
 NE+oserZzw6BST1yEgGzGX0WT5i0kNMFeg==
X-Google-Smtp-Source: 
 APXvYqy/fAJIBejgM0wOCqYQB9/HCw/xillSQiqoP38fasDYLYETiPDuDnsWpDxM/eRcGN41wYDlsw==
X-Received: by 2002:a7b:cb97:: with SMTP id m23mr4552903wmi.37.1579793460755;
 Thu, 23 Jan 2020 07:31:00 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 16/20] hw/char/exynos4210_uart: Convert to support tracing
Date: Thu, 23 Jan 2020 15:30:37 +0000
Message-Id: <20200123153041.4248-17-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::343
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

Replace debug code with tracing to aid debugging.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-5-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/char/exynos4210_uart.c | 96 ++++++++++++---------------------------
 hw/char/trace-events      | 17 +++++++
 2 files changed, 47 insertions(+), 66 deletions(-)

diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index 7e5c5ce789b..b3199df865e 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -31,45 +31,7 @@
 #include "hw/irq.h"
 #include "hw/qdev-properties.h"
=20
-#undef DEBUG_UART
-#undef DEBUG_UART_EXTEND
-#undef DEBUG_IRQ
-#undef DEBUG_Rx_DATA
-#undef DEBUG_Tx_DATA
-
-#define DEBUG_UART            0
-#define DEBUG_UART_EXTEND     0
-#define DEBUG_IRQ             0
-#define DEBUG_Rx_DATA         0
-#define DEBUG_Tx_DATA         0
-
-#if DEBUG_UART
-#define  PRINT_DEBUG(fmt, args...)  \
-        do { \
-            fprintf(stderr, "  [%s:%d]   "fmt, __func__, __LINE__, ##args)=
; \
-        } while (0)
-
-#if DEBUG_UART_EXTEND
-#define  PRINT_DEBUG_EXTEND(fmt, args...) \
-        do { \
-            fprintf(stderr, "  [%s:%d]   "fmt, __func__, __LINE__, ##args)=
; \
-        } while (0)
-#else
-#define  PRINT_DEBUG_EXTEND(fmt, args...) \
-        do {} while (0)
-#endif /* EXTEND */
-
-#else
-#define  PRINT_DEBUG(fmt, args...)  \
-        do {} while (0)
-#define  PRINT_DEBUG_EXTEND(fmt, args...) \
-        do {} while (0)
-#endif
-
-#define  PRINT_ERROR(fmt, args...) \
-        do { \
-            fprintf(stderr, "  [%s:%d]   "fmt, __func__, __LINE__, ##args)=
; \
-        } while (0)
+#include "trace.h"
=20
 /*
  *  Offsets for UART registers relative to SFR base address
@@ -193,8 +155,7 @@ typedef struct Exynos4210UartState {
 } Exynos4210UartState;
=20
=20
-#if DEBUG_UART
-/* Used only for debugging inside PRINT_DEBUG_... macros */
+/* Used only for tracing */
 static const char *exynos4210_uart_regname(hwaddr  offset)
 {
=20
@@ -208,7 +169,6 @@ static const char *exynos4210_uart_regname(hwaddr  offs=
et)
=20
     return NULL;
 }
-#endif
=20
=20
 static void fifo_store(Exynos4210UartFIFO *q, uint8_t ch)
@@ -271,7 +231,7 @@ static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(c=
onst Exynos4210UartState
         break;
     default:
         level =3D 0;
-        PRINT_ERROR("Wrong UART channel number: %d\n", s->channel);
+        trace_exynos_uart_channel_error(s->channel);
     }
=20
     return level;
@@ -297,14 +257,10 @@ static void exynos4210_uart_update_irq(Exynos4210Uart=
State *s)
=20
     if (s->reg[I_(UINTP)]) {
         qemu_irq_raise(s->irq);
-
-#if DEBUG_IRQ
-        fprintf(stderr, "UART%d: IRQ has been raised: %08x\n",
-                s->channel, s->reg[I_(UINTP)]);
-#endif
-
+        trace_exynos_uart_irq_raised(s->channel, s->reg[I_(UINTP)]);
     } else {
         qemu_irq_lower(s->irq);
+        trace_exynos_uart_irq_lowered(s->channel);
     }
 }
=20
@@ -348,7 +304,7 @@ static void exynos4210_uart_update_parameters(Exynos421=
0UartState *s)
=20
     qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
=20
-    PRINT_DEBUG("UART%d: speed: %d, parity: %c, data: %d, stop: %d\n",
+    trace_exynos_uart_update_params(
                 s->channel, speed, parity, data_bits, stop_bits);
 }
=20
@@ -358,8 +314,8 @@ static void exynos4210_uart_write(void *opaque, hwaddr =
offset,
     Exynos4210UartState *s =3D (Exynos4210UartState *)opaque;
     uint8_t ch;
=20
-    PRINT_DEBUG_EXTEND("UART%d: <0x%04x> %s <- 0x%08llx\n", s->channel,
-        offset, exynos4210_uart_regname(offset), (long long unsigned int)v=
al);
+    trace_exynos_uart_write(s->channel, offset,
+                            exynos4210_uart_regname(offset), val);
=20
     switch (offset) {
     case ULCON:
@@ -373,12 +329,12 @@ static void exynos4210_uart_write(void *opaque, hwadd=
r offset,
         if (val & UFCON_Rx_FIFO_RESET) {
             fifo_reset(&s->rx);
             s->reg[I_(UFCON)] &=3D ~UFCON_Rx_FIFO_RESET;
-            PRINT_DEBUG("UART%d: Rx FIFO Reset\n", s->channel);
+            trace_exynos_uart_rx_fifo_reset(s->channel);
         }
         if (val & UFCON_Tx_FIFO_RESET) {
             fifo_reset(&s->tx);
             s->reg[I_(UFCON)] &=3D ~UFCON_Tx_FIFO_RESET;
-            PRINT_DEBUG("UART%d: Tx FIFO Reset\n", s->channel);
+            trace_exynos_uart_tx_fifo_reset(s->channel);
         }
         break;
=20
@@ -390,9 +346,7 @@ static void exynos4210_uart_write(void *opaque, hwaddr =
offset,
             /* XXX this blocks entire thread. Rewrite to use
              * qemu_chr_fe_write and background I/O callbacks */
             qemu_chr_fe_write_all(&s->chr, &ch, 1);
-#if DEBUG_Tx_DATA
-            fprintf(stderr, "%c", ch);
-#endif
+            trace_exynos_uart_tx(s->channel, ch);
             s->reg[I_(UTRSTAT)] |=3D UTRSTAT_TRANSMITTER_EMPTY |
                     UTRSTAT_Tx_BUFFER_EMPTY;
             s->reg[I_(UINTSP)]  |=3D UINTSP_TXD;
@@ -403,8 +357,7 @@ static void exynos4210_uart_write(void *opaque, hwaddr =
offset,
     case UINTP:
         s->reg[I_(UINTP)] &=3D ~val;
         s->reg[I_(UINTSP)] &=3D ~val;
-        PRINT_DEBUG("UART%d: UINTP [%04x] have been cleared: %08x\n",
-                    s->channel, offset, s->reg[I_(UINTP)]);
+        trace_exynos_uart_intclr(s->channel, s->reg[I_(UINTP)]);
         exynos4210_uart_update_irq(s);
         break;
     case UTRSTAT:
@@ -412,7 +365,7 @@ static void exynos4210_uart_write(void *opaque, hwaddr =
offset,
     case UFSTAT:
     case UMSTAT:
     case URXH:
-        PRINT_DEBUG("UART%d: Trying to write into RO register: %s [%04x]\n=
",
+        trace_exynos_uart_ro_write(
                     s->channel, exynos4210_uart_regname(offset), offset);
         break;
     case UINTSP:
@@ -439,6 +392,8 @@ static uint64_t exynos4210_uart_read(void *opaque, hwad=
dr offset,
     case UERSTAT: /* Read Only */
         res =3D s->reg[I_(UERSTAT)];
         s->reg[I_(UERSTAT)] =3D 0;
+        trace_exynos_uart_read(s->channel, offset,
+                               exynos4210_uart_regname(offset), res);
         return res;
     case UFSTAT: /* Read Only */
         s->reg[I_(UFSTAT)] =3D fifo_elements_number(&s->rx) & 0xff;
@@ -446,20 +401,22 @@ static uint64_t exynos4210_uart_read(void *opaque, hw=
addr offset,
             s->reg[I_(UFSTAT)] |=3D UFSTAT_Rx_FIFO_FULL;
             s->reg[I_(UFSTAT)] &=3D ~0xff;
         }
+        trace_exynos_uart_read(s->channel, offset,
+                               exynos4210_uart_regname(offset),
+                               s->reg[I_(UFSTAT)]);
         return s->reg[I_(UFSTAT)];
     case URXH:
         if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
             if (fifo_elements_number(&s->rx)) {
                 res =3D fifo_retrieve(&s->rx);
-#if DEBUG_Rx_DATA
-                fprintf(stderr, "%c", res);
-#endif
+                trace_exynos_uart_rx(s->channel, res);
                 if (!fifo_elements_number(&s->rx)) {
                     s->reg[I_(UTRSTAT)] &=3D ~UTRSTAT_Rx_BUFFER_DATA_READY;
                 } else {
                     s->reg[I_(UTRSTAT)] |=3D UTRSTAT_Rx_BUFFER_DATA_READY;
                 }
             } else {
+                trace_exynos_uart_rx_error(s->channel);
                 s->reg[I_(UINTSP)] |=3D UINTSP_ERROR;
                 exynos4210_uart_update_irq(s);
                 res =3D 0;
@@ -468,15 +425,22 @@ static uint64_t exynos4210_uart_read(void *opaque, hw=
addr offset,
             s->reg[I_(UTRSTAT)] &=3D ~UTRSTAT_Rx_BUFFER_DATA_READY;
             res =3D s->reg[I_(URXH)];
         }
+        trace_exynos_uart_read(s->channel, offset,
+                               exynos4210_uart_regname(offset), res);
         return res;
     case UTXH:
-        PRINT_DEBUG("UART%d: Trying to read from WO register: %s [%04x]\n",
-                    s->channel, exynos4210_uart_regname(offset), offset);
+        trace_exynos_uart_wo_read(s->channel, exynos4210_uart_regname(offs=
et),
+                                  offset);
         break;
     default:
+        trace_exynos_uart_read(s->channel, offset,
+                               exynos4210_uart_regname(offset),
+                               s->reg[I_(offset)]);
         return s->reg[I_(offset)];
     }
=20
+    trace_exynos_uart_read(s->channel, offset, exynos4210_uart_regname(off=
set),
+                           0);
     return 0;
 }
=20
@@ -555,7 +519,7 @@ static void exynos4210_uart_reset(DeviceState *dev)
     fifo_reset(&s->rx);
     fifo_reset(&s->tx);
=20
-    PRINT_DEBUG("UART%d: Rx FIFO size: %d\n", s->channel, s->rx.size);
+    trace_exynos_uart_rxsize(s->channel, s->rx.size);
 }
=20
 static const VMStateDescription vmstate_exynos4210_uart_fifo =3D {
diff --git a/hw/char/trace-events b/hw/char/trace-events
index 2ce7f2f9987..ba28b45b532 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -77,3 +77,20 @@ cmsdk_apb_uart_set_params(int speed) "CMSDK APB UART: pa=
rams set to %d 8N1"
 # nrf51_uart.c
 nrf51_uart_read(uint64_t addr, uint64_t r, unsigned int size) "addr 0x%" P=
RIx64 " value 0x%" PRIx64 " size %u"
 nrf51_uart_write(uint64_t addr, uint64_t value, unsigned int size) "addr 0=
x%" PRIx64 " value 0x%" PRIx64 " size %u"
+
+# exynos4210_uart.c
+exynos_uart_irq_raised(uint32_t channel, uint32_t reg) "UART%d: IRQ raised=
: 0x%08"PRIx32
+exynos_uart_irq_lowered(uint32_t channel) "UART%d: IRQ lowered"
+exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int=
 data, int stop) "UART%d: speed: %d, parity: %c, data bits: %d, stop bits: =
%d"
+exynos_uart_write(uint32_t channel, uint32_t offset, const char *name, uin=
t64_t val) "UART%d: <0x%04x> %s <- 0x%" PRIx64
+exynos_uart_read(uint32_t channel, uint32_t offset, const char *name, uint=
64_t val) "UART%d: <0x%04x> %s -> 0x%" PRIx64
+exynos_uart_rx_fifo_reset(uint32_t channel) "UART%d: Rx FIFO Reset"
+exynos_uart_tx_fifo_reset(uint32_t channel) "UART%d: Tx FIFO Reset"
+exynos_uart_tx(uint32_t channel, uint8_t ch) "UART%d: Tx 0x%02"PRIx32
+exynos_uart_intclr(uint32_t channel, uint32_t reg) "UART%d: interrupts cle=
ared: 0x%08"PRIx32
+exynos_uart_ro_write(uint32_t channel, const char *name, uint32_t reg) "UA=
RT%d: Trying to write into RO register: %s [0x%04"PRIx32"]"
+exynos_uart_rx(uint32_t channel, uint8_t ch) "UART%d: Rx 0x%02"PRIx32
+exynos_uart_rx_error(uint32_t channel) "UART%d: Rx error"
+exynos_uart_wo_read(uint32_t channel, const char *name, uint32_t reg) "UAR=
T%d: Trying to read from WO register: %s [0x%04"PRIx32"]"
+exynos_uart_rxsize(uint32_t channel, uint32_t size) "UART%d: Rx FIFO size:=
 %d"
+exynos_uart_channel_error(uint32_t channel) "Wrong UART channel number: %d"
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579802031; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Nzdh5NPO9+HTt5tqnqc4jafFWkXiUuyJbK9zygF54dgbK6zsFqCbFKT488Fh/amZ5qbh+zmFsgX2wob4yRMbagZfpbm+JxF1qDT3IY75cmK5LMMhhMK+OevEF7nEIX3OpzoSkbSHsqaBeFF8j5E+crv0hnQ2+5twQ6a6dEFUqy0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579802031;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=o4xSgx2m35zUuP+7sJH7VCULByapC4KhuLB9uUeF7Ow=;
	b=BfA1uSQSZqhscmwrs8xIB/G2EvAZJ4oR/6dtf/BBMsn+EH5/vgOvhwzabFqGxKawPX9pUViut+U4YBt3C8+5WBKjg80AhZ8GXzEl1Lz0/MMGf9pimonQp3CJZnBX0UwKu03FGTXAj1TbTEdZbbv4OAnMK0iahoCKfOmZkWfCQ2g=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579802030977905.5106770810158;
 Thu, 23 Jan 2020 09:53:50 -0800 (PST)
Received: from localhost ([::1]:34024 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugfs-0000hV-T3
	for importer@patchew.org; Thu, 23 Jan 2020 12:53:49 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48477)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRl-0000Ux-KW
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:11 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRj-0003xr-Vr
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:05 -0500
Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:34328)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRj-0003vc-PL
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:03 -0500
Received: by mail-wr1-x441.google.com with SMTP id t2so3586228wrr.1
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:31:03 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.31.00
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:31:01 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=o4xSgx2m35zUuP+7sJH7VCULByapC4KhuLB9uUeF7Ow=;
 b=ywwETYnzr/RN6Ud+RLG8i4NbvraIIeDSjbmLN82lnjEGCyiF0ouZRfZfIel84lE/1q
 L1csCvZ1QbZYdcZ7EIk6GHY0eAFwbgLyvxXK9hcec94tcTCForEHIOpU3ZcCb6Dhk4tz
 q/JklHRObWqFCIDGA+fUckMPhiBUg2/xxY6Vf2omO7ZBhJQvDr2pufkZ4FV1pPajfMZj
 FMXDWaNDiULAuqtKmYHoOyMhtV8cBrXE6kaxJOksXuTtuHzQ5E80K+mJDy80Hqk5+5Zq
 jzMBVW2p5NGe1JpCRB4OXnR7u5SvFRJYnwZGPu+stIvHvymP1pQEHqISJtwqhhwghMs5
 QW/w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=o4xSgx2m35zUuP+7sJH7VCULByapC4KhuLB9uUeF7Ow=;
 b=uL98+DLAwhmh0dsmagS+OJl3ftVDp622rVkCK4Gd8Lm1+fqlEwQrQ31bD9N1c2K2qA
 FSWNvTc8y7a4Myr4ms7zg81arkRjw6uGu0N1H2VwMjITmyYuCEeT99OgMqLsMtsBB+qj
 L3HSJyP9P5/62kPO2rQvDIwlef1GoOtvTYzSaod86O4xKe6hOH604bAiQrA4mBBYl2Ju
 E/gOcCisj4KT5Qgn5wlysnSZGp+xF239Bdc+YWqypyNXMUjMuDLCHvXex0o04E+6Zh1+
 5NXuPHwq8dzhLpRYX1BGGlYWmyOsrEoJBD/LsCHQECD/2RRp2FpnwD84GJ4Njk+H8Zid
 OJBA==
X-Gm-Message-State: APjAAAXBtcnFbo9VIXev5RkOH4XbMIjdPRkj7WKr45riQIoIHp2M/tMD
 9tT6hCJreENmR7CqXIF8FkxIF2KxXIUFNg==
X-Google-Smtp-Source: 
 APXvYqy9pOmxSNxVk36Bh76kznSZXaDbRyt0tJzhOPt+BfKnZYEwiMsLYC7y2TWOYlqk18MeZbrU9w==
X-Received: by 2002:adf:b648:: with SMTP id i8mr18076969wre.91.1579793461680;
 Thu, 23 Jan 2020 07:31:01 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 17/20] hw/char/exynos4210_uart: Implement post_load function
Date: Thu, 23 Jan 2020 15:30:38 +0000
Message-Id: <20200123153041.4248-18-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::441
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

After restoring a VM, serial parameters need to be updated to reflect
restored register values. Implement a post_load function to handle this
situation.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-6-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/char/exynos4210_uart.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index b3199df865e..6ffbaddfff1 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -522,10 +522,20 @@ static void exynos4210_uart_reset(DeviceState *dev)
     trace_exynos_uart_rxsize(s->channel, s->rx.size);
 }
=20
+static int exynos4210_uart_post_load(void *opaque, int version_id)
+{
+    Exynos4210UartState *s =3D (Exynos4210UartState *)opaque;
+
+    exynos4210_uart_update_parameters(s);
+
+    return 0;
+}
+
 static const VMStateDescription vmstate_exynos4210_uart_fifo =3D {
     .name =3D "exynos4210.uart.fifo",
     .version_id =3D 1,
     .minimum_version_id =3D 1,
+    .post_load =3D exynos4210_uart_post_load,
     .fields =3D (VMStateField[]) {
         VMSTATE_UINT32(sp, Exynos4210UartFIFO),
         VMSTATE_UINT32(rp, Exynos4210UartFIFO),
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579802424; cv=none;
	d=zohomail.com; s=zohoarc;
	b=UKqcQZHHDLV3X8QAPglXHXLWwn9P5/SayWo8aQMtlq80iNrx3JXQKrT0S1oXPROp2TDj1depdiqGPawgaNQ2xwD6cj4AJlUXagtYj291VrgDX16792jS/xLwfwjuUHbf2IfAwBdQWf19FJ9nr+cutcg/M80Ds8IvvwBxIVfVf+4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579802424;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=6T47eZ4vWB2mF6kI3SN4Zx+sefAzMAYpYuNqQIJE+Lc=;
	b=XZw/azHFSAUGDA9tCLhlZx22g37O27csGVJwM/uACiG7G3Rs119YXKBxau7X+MowzCkONWCGTHe76pD7iVop01L9AflVxQykSpJlzZfDsLiXgFua38j+y51Im9rf6oWaE8uItgL9p9YtnXt7rdJlXPVsjalSK4sRUgkNrnXQxAs=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579802424677400.1480463134427;
 Thu, 23 Jan 2020 10:00:24 -0800 (PST)
Received: from localhost ([::1]:34146 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugmF-0000xQ-CL
	for importer@patchew.org; Thu, 23 Jan 2020 13:00:23 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48511)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRo-0000W9-J7
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:14 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRl-0003yc-JC
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:07 -0500
Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:40749)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRk-0003wu-2H
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:05 -0500
Received: by mail-wm1-x336.google.com with SMTP id t14so2967526wmi.5
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:31:03 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.31.01
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:31:02 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=6T47eZ4vWB2mF6kI3SN4Zx+sefAzMAYpYuNqQIJE+Lc=;
 b=Cu3Kzr1Frz+eGQReEp/869Qizegwb0VG+Ej0QwZahzWiOuBuAo/+oyA26YHmT8uAK8
 PfTdIZD8oYiswWnnxXkAHnmtsLk8HmvNZxAsITXil8D5SYQaF1tandPpeASpwHQ9N0Bn
 cUgT19ym3dCxd/VhYIzTwPAFKlvIMX2n8feXm1bsAS3/G10V61dCzaJKBgfiewybnLMq
 F6Jjlq/ARHhsLsWLbjxdVpkscsr8QOSPWC/Scl3ndfZcQE0lfE8POrcf01gcp9l2PbQJ
 Cp8/xULJvLSMzLCAbwt54N3YuLCERd/e1RtSiY/qP26k3LfpqSJKyTcA/MtdNeTB6iAq
 bXow==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=6T47eZ4vWB2mF6kI3SN4Zx+sefAzMAYpYuNqQIJE+Lc=;
 b=g74gZfoRTknxoGcVfW4BvBFgb4QGw63HVPq5UDA7TdK1eFjhTUbzMD6hQEgmQznGyq
 B13bcdn/N16wO76V0yeXoOXPk2QH8Yqz535YoOWFPsoWMoPaiRI6LuuWI1Iivm9HuSvB
 7wa+9dXHW4hW6ERzh0y4g3JCGiYNyLPTJCFhs41a+P37Wx/927sj1VSbI48kg8m344OH
 y2gQ7CLbwb/a1XsscrEAY7HJrbBRmdjZ/cT2l4TGMTIhWuKpGK2XTOSqCr4rMW1/CHm5
 ZjnKspZ6/u8IMxODDngTfgeAwUQZdIbG7MvcPshS4OyLTRKdWvZOWPa/Km70BR64BAKs
 NLtg==
X-Gm-Message-State: APjAAAV5UvRL+mG4WpotYCvM/7utFzmJen5IQET6+six1pFid7ulUxOJ
 ZIkvVX4Gb00v0sdMk3PkNDp73x6rHR1Ucw==
X-Google-Smtp-Source: 
 APXvYqxpCLctWgIQ915fh5AZXlPHRtrym5KBXPZE74zgEC/8Uy35l6V8lnk8n/f/d+s9vYQ64I6vRw==
X-Received: by 2002:a1c:7d93:: with SMTP id
 y141mr4706813wmc.111.1579793462794;
 Thu, 23 Jan 2020 07:31:02 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 18/20] hw/char/exynos4210_uart: Implement Rx FIFO level
 triggers and timeouts
Date: Thu, 23 Jan 2020 15:30:39 +0000
Message-Id: <20200123153041.4248-19-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::336
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

The driver already implements a receive FIFO, but it does not
handle receive FIFO trigger levels and timeout. Implement the
missing functionality.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-7-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/char/exynos4210_uart.c | 117 ++++++++++++++++++++++++++++++--------
 hw/char/trace-events      |   3 +-
 2 files changed, 94 insertions(+), 26 deletions(-)

diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index 6ffbaddfff1..363393cc753 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -24,6 +24,7 @@
 #include "migration/vmstate.h"
 #include "qemu/error-report.h"
 #include "qemu/module.h"
+#include "qemu/timer.h"
 #include "chardev/char-fe.h"
 #include "chardev/char-serial.h"
=20
@@ -118,6 +119,7 @@ static const Exynos4210UartReg exynos4210_uart_regs[] =
=3D {
 #define ULCON_STOP_BIT_SHIFT  1
=20
 /* UART Tx/Rx Status */
+#define UTRSTAT_Rx_TIMEOUT              0x8
 #define UTRSTAT_TRANSMITTER_EMPTY       0x4
 #define UTRSTAT_Tx_BUFFER_EMPTY         0x2
 #define UTRSTAT_Rx_BUFFER_DATA_READY    0x1
@@ -147,6 +149,9 @@ typedef struct Exynos4210UartState {
     Exynos4210UartFIFO   rx;
     Exynos4210UartFIFO   tx;
=20
+    QEMUTimer *fifo_timeout_timer;
+    uint64_t wordtime;        /* word time in ns */
+
     CharBackend       chr;
     qemu_irq          irq;
=20
@@ -209,15 +214,12 @@ static void fifo_reset(Exynos4210UartFIFO *q)
     q->rp =3D 0;
 }
=20
-static uint32_t exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210Uart=
State *s)
+static uint32_t exynos4210_uart_FIFO_trigger_level(uint32_t channel,
+                                                   uint32_t reg)
 {
-    uint32_t level =3D 0;
-    uint32_t reg;
+    uint32_t level;
=20
-    reg =3D (s->reg[I_(UFCON)] & UFCON_Tx_FIFO_TRIGGER_LEVEL) >>
-            UFCON_Tx_FIFO_TRIGGER_LEVEL_SHIFT;
-
-    switch (s->channel) {
+    switch (channel) {
     case 0:
         level =3D reg * 32;
         break;
@@ -231,12 +233,34 @@ static uint32_t exynos4210_uart_Tx_FIFO_trigger_level=
(const Exynos4210UartState
         break;
     default:
         level =3D 0;
-        trace_exynos_uart_channel_error(s->channel);
+        trace_exynos_uart_channel_error(channel);
+        break;
     }
-
     return level;
 }
=20
+static uint32_t
+exynos4210_uart_Tx_FIFO_trigger_level(const Exynos4210UartState *s)
+{
+    uint32_t reg;
+
+    reg =3D (s->reg[I_(UFCON)] & UFCON_Tx_FIFO_TRIGGER_LEVEL) >>
+            UFCON_Tx_FIFO_TRIGGER_LEVEL_SHIFT;
+
+    return exynos4210_uart_FIFO_trigger_level(s->channel, reg);
+}
+
+static uint32_t
+exynos4210_uart_Rx_FIFO_trigger_level(const Exynos4210UartState *s)
+{
+    uint32_t reg;
+
+    reg =3D ((s->reg[I_(UFCON)] & UFCON_Rx_FIFO_TRIGGER_LEVEL) >>
+            UFCON_Rx_FIFO_TRIGGER_LEVEL_SHIFT) + 1;
+
+    return exynos4210_uart_FIFO_trigger_level(s->channel, reg);
+}
+
 static void exynos4210_uart_update_irq(Exynos4210UartState *s)
 {
     /*
@@ -244,13 +268,25 @@ static void exynos4210_uart_update_irq(Exynos4210Uart=
State *s)
      * transmit FIFO is smaller than the trigger level.
      */
     if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
-
         uint32_t count =3D (s->reg[I_(UFSTAT)] & UFSTAT_Tx_FIFO_COUNT) >>
                 UFSTAT_Tx_FIFO_COUNT_SHIFT;
=20
         if (count <=3D exynos4210_uart_Tx_FIFO_trigger_level(s)) {
             s->reg[I_(UINTSP)] |=3D UINTSP_TXD;
         }
+
+        /*
+         * Rx interrupt if trigger level is reached or if rx timeout
+         * interrupt is disabled and there is data in the receive buffer
+         */
+        count =3D fifo_elements_number(&s->rx);
+        if ((count && !(s->reg[I_(UCON)] & 0x80)) ||
+            count >=3D exynos4210_uart_Rx_FIFO_trigger_level(s)) {
+            s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
+            timer_del(s->fifo_timeout_timer);
+        }
+    } else if (s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY) {
+        s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
     }
=20
     s->reg[I_(UINTP)] =3D s->reg[I_(UINTSP)] & ~s->reg[I_(UINTM)];
@@ -264,6 +300,21 @@ static void exynos4210_uart_update_irq(Exynos4210UartS=
tate *s)
     }
 }
=20
+static void exynos4210_uart_timeout_int(void *opaque)
+{
+    Exynos4210UartState *s =3D opaque;
+
+    trace_exynos_uart_rx_timeout(s->channel, s->reg[I_(UTRSTAT)],
+                                 s->reg[I_(UINTSP)]);
+
+    if ((s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY) ||
+        (s->reg[I_(UCON)] & (1 << 11))) {
+        s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
+        s->reg[I_(UTRSTAT)] |=3D UTRSTAT_Rx_TIMEOUT;
+        exynos4210_uart_update_irq(s);
+    }
+}
+
 static void exynos4210_uart_update_parameters(Exynos4210UartState *s)
 {
     int speed, parity, data_bits, stop_bits;
@@ -302,10 +353,24 @@ static void exynos4210_uart_update_parameters(Exynos4=
210UartState *s)
     ssp.data_bits =3D data_bits;
     ssp.stop_bits =3D stop_bits;
=20
+    s->wordtime =3D NANOSECONDS_PER_SECOND * (data_bits + stop_bits + 1) /=
 speed;
+
     qemu_chr_fe_ioctl(&s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
=20
     trace_exynos_uart_update_params(
-                s->channel, speed, parity, data_bits, stop_bits);
+                s->channel, speed, parity, data_bits, stop_bits, s->wordti=
me);
+}
+
+static void exynos4210_uart_rx_timeout_set(Exynos4210UartState *s)
+{
+    if (s->reg[I_(UCON)] & 0x80) {
+        uint32_t timeout =3D ((s->reg[I_(UCON)] >> 12) & 0x0f) * s->wordti=
me;
+
+        timer_mod(s->fifo_timeout_timer,
+                  qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + timeout);
+    } else {
+        timer_del(s->fifo_timeout_timer);
+    }
 }
=20
 static void exynos4210_uart_write(void *opaque, hwaddr offset,
@@ -361,6 +426,10 @@ static void exynos4210_uart_write(void *opaque, hwaddr=
 offset,
         exynos4210_uart_update_irq(s);
         break;
     case UTRSTAT:
+        if (val & UTRSTAT_Rx_TIMEOUT) {
+            s->reg[I_(UTRSTAT)] &=3D ~UTRSTAT_Rx_TIMEOUT;
+        }
+        break;
     case UERSTAT:
     case UFSTAT:
     case UMSTAT:
@@ -382,6 +451,7 @@ static void exynos4210_uart_write(void *opaque, hwaddr =
offset,
         break;
     }
 }
+
 static uint64_t exynos4210_uart_read(void *opaque, hwaddr offset,
                                   unsigned size)
 {
@@ -461,7 +531,6 @@ static int exynos4210_uart_can_receive(void *opaque)
     return fifo_empty_elements_number(&s->rx);
 }
=20
-
 static void exynos4210_uart_receive(void *opaque, const uint8_t *buf, int =
size)
 {
     Exynos4210UartState *s =3D (Exynos4210UartState *)opaque;
@@ -469,24 +538,17 @@ static void exynos4210_uart_receive(void *opaque, con=
st uint8_t *buf, int size)
=20
     if (s->reg[I_(UFCON)] & UFCON_FIFO_ENABLE) {
         if (fifo_empty_elements_number(&s->rx) < size) {
-            for (i =3D 0; i < fifo_empty_elements_number(&s->rx); i++) {
-                fifo_store(&s->rx, buf[i]);
-            }
+            size =3D fifo_empty_elements_number(&s->rx);
             s->reg[I_(UINTSP)] |=3D UINTSP_ERROR;
-            s->reg[I_(UTRSTAT)] |=3D UTRSTAT_Rx_BUFFER_DATA_READY;
-        } else {
-            for (i =3D 0; i < size; i++) {
-                fifo_store(&s->rx, buf[i]);
-            }
-            s->reg[I_(UTRSTAT)] |=3D UTRSTAT_Rx_BUFFER_DATA_READY;
         }
-        /* XXX: Around here we maybe should check Rx trigger level */
-        s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
+        for (i =3D 0; i < size; i++) {
+            fifo_store(&s->rx, buf[i]);
+        }
+        exynos4210_uart_rx_timeout_set(s);
     } else {
         s->reg[I_(URXH)] =3D buf[0];
-        s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
-        s->reg[I_(UTRSTAT)] |=3D UTRSTAT_Rx_BUFFER_DATA_READY;
     }
+    s->reg[I_(UTRSTAT)] |=3D UTRSTAT_Rx_BUFFER_DATA_READY;
=20
     exynos4210_uart_update_irq(s);
 }
@@ -527,6 +589,7 @@ static int exynos4210_uart_post_load(void *opaque, int =
version_id)
     Exynos4210UartState *s =3D (Exynos4210UartState *)opaque;
=20
     exynos4210_uart_update_parameters(s);
+    exynos4210_uart_rx_timeout_set(s);
=20
     return 0;
 }
@@ -588,6 +651,10 @@ static void exynos4210_uart_init(Object *obj)
     SysBusDevice *dev =3D SYS_BUS_DEVICE(obj);
     Exynos4210UartState *s =3D EXYNOS4210_UART(dev);
=20
+    s->fifo_timeout_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL,
+                                         exynos4210_uart_timeout_int, s);
+    s->wordtime =3D NANOSECONDS_PER_SECOND * 10 / 9600;
+
     /* memory mapping */
     memory_region_init_io(&s->iomem, obj, &exynos4210_uart_ops, s,
                           "exynos4210.uart", EXYNOS4210_UART_REGS_MEM_SIZE=
);
diff --git a/hw/char/trace-events b/hw/char/trace-events
index ba28b45b532..cb73fee6a9d 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -81,7 +81,7 @@ nrf51_uart_write(uint64_t addr, uint64_t value, unsigned =
int size) "addr 0x%" PR
 # exynos4210_uart.c
 exynos_uart_irq_raised(uint32_t channel, uint32_t reg) "UART%d: IRQ raised=
: 0x%08"PRIx32
 exynos_uart_irq_lowered(uint32_t channel) "UART%d: IRQ lowered"
-exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int=
 data, int stop) "UART%d: speed: %d, parity: %c, data bits: %d, stop bits: =
%d"
+exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int=
 data, int stop, uint64_t wordtime) "UART%d: speed: %d, parity: %c, data bi=
ts: %d, stop bits: %d wordtime: %"PRId64"ns"
 exynos_uart_write(uint32_t channel, uint32_t offset, const char *name, uin=
t64_t val) "UART%d: <0x%04x> %s <- 0x%" PRIx64
 exynos_uart_read(uint32_t channel, uint32_t offset, const char *name, uint=
64_t val) "UART%d: <0x%04x> %s -> 0x%" PRIx64
 exynos_uart_rx_fifo_reset(uint32_t channel) "UART%d: Rx FIFO Reset"
@@ -94,3 +94,4 @@ exynos_uart_rx_error(uint32_t channel) "UART%d: Rx error"
 exynos_uart_wo_read(uint32_t channel, const char *name, uint32_t reg) "UAR=
T%d: Trying to read from WO register: %s [0x%04"PRIx32"]"
 exynos_uart_rxsize(uint32_t channel, uint32_t size) "UART%d: Rx FIFO size:=
 %d"
 exynos_uart_channel_error(uint32_t channel) "Wrong UART channel number: %d"
+exynos_uart_rx_timeout(uint32_t channel, uint32_t stat, uint32_t intsp) "U=
ART%d: Rx timeout stat=3D0x%x intsp=3D0x%x"
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579802208; cv=none;
	d=zohomail.com; s=zohoarc;
	b=AifNLKioSlFnvBI2GzEAUHKzEWE1cA5C6KTKtvosi18O+SJjximyVfvK1Gro3nM45E7FrtOdBXuz1oPc/TjDYfmGuezayFiqPq9Dh8OvHNI0GA1vOgottXmj0HnC8dU3eBbj1ZX1pLA3vagRcuDeaZOBKH1hHxnSWt95diTSx9M=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579802208;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=N4iqzc8HVW3cMRomMguzId5zTp6jmQsqn0qSxi9wOqY=;
	b=n0/mnmb0A1YohqSnynCV/LdyJu6hW+oaK24NDb3Wken+zUKvWBuowUno8N4sDlH6GJ5+lcYORerwj8QnFfdhYRN18OlriD5h55g2X9b4Y08ra3qnGh5mSvEA+DnHFvIFq7bmuMea9CKyUhfKIYdo3lVd5dpKnva7eVZ3XmZJ3ic=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579802208407425.2647252479974;
 Thu, 23 Jan 2020 09:56:48 -0800 (PST)
Received: from localhost ([::1]:34086 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugik-0004xz-SG
	for importer@patchew.org; Thu, 23 Jan 2020 12:56:46 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48532)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRr-0000We-3E
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRn-0003zO-2F
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:10 -0500
Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:40248)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRl-0003y5-Ht
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:06 -0500
Received: by mail-wr1-x42c.google.com with SMTP id c14so3537800wrn.7
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:31:05 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.31.02
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:31:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=N4iqzc8HVW3cMRomMguzId5zTp6jmQsqn0qSxi9wOqY=;
 b=BeXWbyXpEAyK9bGvke2mOF6uegOfthWlX5Vw6rTf4cMobJpXiKVfvMdGRZ0Nnti32j
 hnES5yhNH4vSemege2ITAkv27l2pVay/RF/MJCTHQ9xsxBkke1pAggTwD8MGPDrRtui5
 SabIU8JOgQ+AXuVls/RRzEzaLTMhzrw7rXuf2Dw4oWowuny3g9jLMAwCJrK3diNkYbM6
 Y6YFUc9EK7h4dYWhvRYwrDy60FAlS69+m4L8BF1SopTlt6xgyJP3LUx4vix/UL+Ad0U7
 HLyykPGH7x+b9hqnSmbISNJzlO2kWzIOEwQTDP2G8mcCjfiJHUoF1lQ/tf/Ei1r8nPb1
 ZRxw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=N4iqzc8HVW3cMRomMguzId5zTp6jmQsqn0qSxi9wOqY=;
 b=qC6xtQt84GgMCe80hQjeyoT2UyyaRgjOatWeIpzY5gKdmBQEvAt3/ZxqZcesi3tq/B
 J2vrpuS35sGd2ild2Fmna1MiaHI2E4qqkOy4OoZUzENxsXqEcUn35RQfCyb+CqLjpjsD
 YIRel6hjIkUU27czoaY2H0piSFuypmW+RDOrMTxrFCDsjIROXQIJa0NNUw5aa10Rekbq
 LQLJ/c4oEpr7AMaAOVUV2ouxvzanzNg5eCZWQEV/21GNB6TjeDdAiCCRxswKx/JNlAUY
 tlrVW4oP/Xy4NbsCf88vc/MipphSHhft0lvhLp+ezkaP/LRtjm4WAgQT0sIAxOHi7dfa
 Qmtw==
X-Gm-Message-State: APjAAAVDxi5dfAfoqmbO2KJjAL+IuXxr5ylnAltK9eatb1Jwo/fRpEHc
 XkD/VMFV51fI7d0/ISNTF0hUZd4yJeU4sw==
X-Google-Smtp-Source: 
 APXvYqy5sND+rDFSvdkAF2iacc5J7qxNBavfyY0t/Cy0uxGJgih1BrSOLw7nh0IMYlsB5v/H3BFr8w==
X-Received: by 2002:a5d:540f:: with SMTP id g15mr17459446wrv.86.1579793463792;
 Thu, 23 Jan 2020 07:31:03 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 19/20] hw/char/exynos4210_uart: Add receive DMA support
Date: Thu, 23 Jan 2020 15:30:40 +0000
Message-Id: <20200123153041.4248-20-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::42c
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

To support receive DMA, we need to inform the DMA controller if receive data
is available. Otherwise the DMA controller keeps requesting data, causing
receive errors.

Implement this using an interrupt line. The instantiating code then needs
to connect the interrupt with the matching DMA controller GPIO pin.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-8-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/char/exynos4210_uart.c | 24 ++++++++++++++++++++++++
 hw/char/trace-events      |  2 ++
 2 files changed, 26 insertions(+)

diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c
index 363393cc753..20d85091072 100644
--- a/hw/char/exynos4210_uart.c
+++ b/hw/char/exynos4210_uart.c
@@ -154,6 +154,7 @@ typedef struct Exynos4210UartState {
=20
     CharBackend       chr;
     qemu_irq          irq;
+    qemu_irq          dmairq;
=20
     uint32_t channel;
=20
@@ -261,6 +262,24 @@ exynos4210_uart_Rx_FIFO_trigger_level(const Exynos4210=
UartState *s)
     return exynos4210_uart_FIFO_trigger_level(s->channel, reg);
 }
=20
+/*
+ * Update Rx DMA busy signal if Rx DMA is enabled. For simplicity,
+ * mark DMA as busy if DMA is enabled and the receive buffer is empty.
+ */
+static void exynos4210_uart_update_dmabusy(Exynos4210UartState *s)
+{
+    bool rx_dma_enabled =3D (s->reg[I_(UCON)] & 0x03) =3D=3D 0x02;
+    uint32_t count =3D fifo_elements_number(&s->rx);
+
+    if (rx_dma_enabled && !count) {
+        qemu_irq_raise(s->dmairq);
+        trace_exynos_uart_dmabusy(s->channel);
+    } else {
+        qemu_irq_lower(s->dmairq);
+        trace_exynos_uart_dmaready(s->channel);
+    }
+}
+
 static void exynos4210_uart_update_irq(Exynos4210UartState *s)
 {
     /*
@@ -282,10 +301,12 @@ static void exynos4210_uart_update_irq(Exynos4210Uart=
State *s)
         count =3D fifo_elements_number(&s->rx);
         if ((count && !(s->reg[I_(UCON)] & 0x80)) ||
             count >=3D exynos4210_uart_Rx_FIFO_trigger_level(s)) {
+            exynos4210_uart_update_dmabusy(s);
             s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
             timer_del(s->fifo_timeout_timer);
         }
     } else if (s->reg[I_(UTRSTAT)] & UTRSTAT_Rx_BUFFER_DATA_READY) {
+        exynos4210_uart_update_dmabusy(s);
         s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
     }
=20
@@ -311,6 +332,7 @@ static void exynos4210_uart_timeout_int(void *opaque)
         (s->reg[I_(UCON)] & (1 << 11))) {
         s->reg[I_(UINTSP)] |=3D UINTSP_RXD;
         s->reg[I_(UTRSTAT)] |=3D UTRSTAT_Rx_TIMEOUT;
+        exynos4210_uart_update_dmabusy(s);
         exynos4210_uart_update_irq(s);
     }
 }
@@ -495,6 +517,7 @@ static uint64_t exynos4210_uart_read(void *opaque, hwad=
dr offset,
             s->reg[I_(UTRSTAT)] &=3D ~UTRSTAT_Rx_BUFFER_DATA_READY;
             res =3D s->reg[I_(URXH)];
         }
+        exynos4210_uart_update_dmabusy(s);
         trace_exynos_uart_read(s->channel, offset,
                                exynos4210_uart_regname(offset), res);
         return res;
@@ -661,6 +684,7 @@ static void exynos4210_uart_init(Object *obj)
     sysbus_init_mmio(dev, &s->iomem);
=20
     sysbus_init_irq(dev, &s->irq);
+    sysbus_init_irq(dev, &s->dmairq);
 }
=20
 static void exynos4210_uart_realize(DeviceState *dev, Error **errp)
diff --git a/hw/char/trace-events b/hw/char/trace-events
index cb73fee6a9d..6f938301d98 100644
--- a/hw/char/trace-events
+++ b/hw/char/trace-events
@@ -79,6 +79,8 @@ nrf51_uart_read(uint64_t addr, uint64_t r, unsigned int s=
ize) "addr 0x%" PRIx64
 nrf51_uart_write(uint64_t addr, uint64_t value, unsigned int size) "addr 0=
x%" PRIx64 " value 0x%" PRIx64 " size %u"
=20
 # exynos4210_uart.c
+exynos_uart_dmabusy(uint32_t channel) "UART%d: DMA busy (Rx buffer empty)"
+exynos_uart_dmaready(uint32_t channel) "UART%d: DMA ready"
 exynos_uart_irq_raised(uint32_t channel, uint32_t reg) "UART%d: IRQ raised=
: 0x%08"PRIx32
 exynos_uart_irq_lowered(uint32_t channel) "UART%d: IRQ lowered"
 exynos_uart_update_params(uint32_t channel, int speed, uint8_t parity, int=
 data, int stop, uint64_t wordtime) "UART%d: speed: %d, parity: %c, data bi=
ts: %d, stop bits: %d wordtime: %"PRId64"ns"
--=20
2.20.1


From nobody Wed May  7 20:28:46 2025
Delivered-To: importer@patchew.org
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1579802242; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Tdwi3QPXXueg3xbZv6zlqoTUY23Ic/nI8iSa99GeAXqAx2Iu23mit/Mh+pKSBg3pzfiKojozw8On1goPDmN+CqINfAzelZ6nDIBS8jNuEgwa8EZ1xze9TQKjJYxNV6BdlRF0LmZLPfdQ7g1t0Y5A+txCPPWR4wUQPyj/yo9/euo=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1579802242;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=dRI9oGwUBma3PKFdZ9vN+7KmPWjMM/8sjfA19pvxDs4=;
	b=AXv/vCT5AdRcDCgoBp/J01pXkrTLt+oeCEjivUFGpgEJeHjS9Zdh81cjVG8AgTHvnzGAQHRuoM9Ne7NOE9rMWaI1hFfVkthaEU4l4csIOaVu5AZfRSQRhdr0X7geJgDfwGCnCfi36EvPMTydSs8XB5/oEpxJencu/QKC4rmX+VY=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1579802241234343.08103073708685;
 Thu, 23 Jan 2020 09:57:21 -0800 (PST)
Received: from localhost ([::1]:34094 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1iugjH-0005Yt-I0
	for importer@patchew.org; Thu, 23 Jan 2020 12:57:19 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:48514)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRo-0000WD-KZ
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:13 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <peter.maydell@linaro.org>) id 1iueRn-0003zu-7e
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:08 -0500
Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:36052)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <peter.maydell@linaro.org>)
 id 1iueRm-0003yW-SD
 for qemu-devel@nongnu.org; Thu, 23 Jan 2020 10:31:07 -0500
Received: by mail-wr1-x444.google.com with SMTP id z3so3565372wru.3
 for <qemu-devel@nongnu.org>; Thu, 23 Jan 2020 07:31:05 -0800 (PST)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id s139sm2903592wme.35.2020.01.23.07.31.03
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 23 Jan 2020 07:31:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=dRI9oGwUBma3PKFdZ9vN+7KmPWjMM/8sjfA19pvxDs4=;
 b=lK+sgxVsHoMhCyDfv4fyV46lNtzwp+gjCDjAjplljaIuit+4QSVUDtxwiMWU0+Swkq
 hUK9TurCL8JXsg6gCpLk5cAJCZLwvGol0tIBU7yncvavE0mUVtjT8o6M32Ovf2dibA6a
 +5QIvkFBTXJYu5UVeO7O+IgJpT5g9nJTDbp7nsUVnEtoWhidKhogYfV6IfCCOWKEkWiC
 EyA9pDmsNmTEPhwDHjtWrox/wuk7zj4rxLPx2LjY48krlJya/zlbox+Q3AUIRJOkXZqm
 1OzWCV3wM561/qvHOz1RhXcHHIwBbVfTOY6qrxYjLuY9YHSnu5nyhK5WbhEKv++VwIyQ
 wHkw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=dRI9oGwUBma3PKFdZ9vN+7KmPWjMM/8sjfA19pvxDs4=;
 b=OpDDyguZRZHZ9LNbJwhKf5TKJVY1uYZCO7dePfhFKuU/hxGze5xpJrnajxkgRa296y
 GZy2OGLs01Ulf3R4S+bu3sMc0S7I/XVE4vQuvXUKXK2SHGgbJPNtJDwr8NRVL9lyoBPx
 C+UWFdCCcWGkhRj6k1l3tQUgZDCItkTvhPbv49Ii8RYHisoC0CgFQJgFrJoXeBdiZeaV
 aVw9ULxvflYi0GR4mk0Be+lCwUudZmOUKzEdk0FvGJikUok+wxrK5qOl8aUAG0f8xvXw
 CI0SbPIJMjNmsTz4HOfvLTH4qIhyI00nleTuEAyNHryPrqVpTSJIQj3MiuGAKJSSBOzp
 PmgQ==
X-Gm-Message-State: APjAAAWvB+zRl0hVafpgNFXBMeYHoLk07UR4QviGXTc5WZ6PWFgOJqpQ
 XPgalRMEmKrvKdossOHv34PX/9l4CJT15w==
X-Google-Smtp-Source: 
 APXvYqy8lxtElJKYHmLnHnkhSBo35lqIcpdGAVYxbgAN71OUUegDJOePv6V4fr4l0yllE0LWJ3MQWw==
X-Received: by 2002:adf:ea51:: with SMTP id j17mr18304286wrn.83.1579793464768;
 Thu, 23 Jan 2020 07:31:04 -0800 (PST)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 20/20] hw/arm/exynos4210: Connect serial port DMA busy signals
 with pl330
Date: Thu, 23 Jan 2020 15:30:41 +0000
Message-Id: <20200123153041.4248-21-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200123153041.4248-1-peter.maydell@linaro.org>
References: <20200123153041.4248-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::444
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
Content-Type: text/plain; charset="utf-8"

From: Guenter Roeck <linux@roeck-us.net>

The Exynos4210 serial driver uses an interrupt line to signal if receive
data is available. Connect that interrupt with the DMA controller's
'peripheral busy' gpio pin to stop the DMA if there is no more receive
data available. Without this patch, receive DMA runs wild and fills the
entire receive DMA buffer with invalid data.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20200123052540.6132-9-linux@roeck-us.net
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/arm/exynos4210.c | 42 +++++++++++++++++++++++++++++-------------
 1 file changed, 29 insertions(+), 13 deletions(-)

diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
index 7701a3fa8bd..59a27bdd68f 100644
--- a/hw/arm/exynos4210.c
+++ b/hw/arm/exynos4210.c
@@ -166,8 +166,8 @@ static uint64_t exynos4210_calc_affinity(int cpu)
     return (0x9 << ARM_AFF1_SHIFT) | cpu;
 }
=20
-static void pl330_create(uint32_t base, qemu_or_irq *orgate, qemu_irq irq,
-                         int nreq, int nevents, int width)
+static DeviceState *pl330_create(uint32_t base, qemu_or_irq *orgate,
+                                 qemu_irq irq, int nreq, int nevents, int =
width)
 {
     SysBusDevice *busdev;
     DeviceState *dev;
@@ -196,6 +196,7 @@ static void pl330_create(uint32_t base, qemu_or_irq *or=
gate, qemu_irq irq,
         sysbus_connect_irq(busdev, i, qdev_get_gpio_in(DEVICE(orgate), i));
     }
     qdev_connect_gpio_out(DEVICE(orgate), 0, irq);
+    return dev;
 }
=20
 static void exynos4210_realize(DeviceState *socdev, Error **errp)
@@ -204,7 +205,7 @@ static void exynos4210_realize(DeviceState *socdev, Err=
or **errp)
     MemoryRegion *system_mem =3D get_system_memory();
     qemu_irq gate_irq[EXYNOS4210_NCPUS][EXYNOS4210_IRQ_GATE_NINPUTS];
     SysBusDevice *busdev;
-    DeviceState *dev;
+    DeviceState *dev, *uart[4], *pl330[3];
     int i, n;
=20
     for (n =3D 0; n < EXYNOS4210_NCPUS; n++) {
@@ -390,19 +391,19 @@ static void exynos4210_realize(DeviceState *socdev, E=
rror **errp)
=20
=20
     /*** UARTs ***/
-    exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR,
+    uart[0] =3D exynos4210_uart_create(EXYNOS4210_UART0_BASE_ADDR,
                            EXYNOS4210_UART0_FIFO_SIZE, 0, serial_hd(0),
                   s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP,=
 0)]);
=20
-    exynos4210_uart_create(EXYNOS4210_UART1_BASE_ADDR,
+    uart[1] =3D exynos4210_uart_create(EXYNOS4210_UART1_BASE_ADDR,
                            EXYNOS4210_UART1_FIFO_SIZE, 1, serial_hd(1),
                   s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP,=
 1)]);
=20
-    exynos4210_uart_create(EXYNOS4210_UART2_BASE_ADDR,
+    uart[2] =3D exynos4210_uart_create(EXYNOS4210_UART2_BASE_ADDR,
                            EXYNOS4210_UART2_FIFO_SIZE, 2, serial_hd(2),
                   s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP,=
 2)]);
=20
-    exynos4210_uart_create(EXYNOS4210_UART3_BASE_ADDR,
+    uart[3] =3D exynos4210_uart_create(EXYNOS4210_UART3_BASE_ADDR,
                            EXYNOS4210_UART3_FIFO_SIZE, 3, serial_hd(3),
                   s->irq_table[exynos4210_get_irq(EXYNOS4210_UART_INT_GRP,=
 3)]);
=20
@@ -450,12 +451,27 @@ static void exynos4210_realize(DeviceState *socdev, E=
rror **errp)
             s->irq_table[exynos4210_get_irq(28, 3)]);
=20
     /*** DMA controllers ***/
-    pl330_create(EXYNOS4210_PL330_BASE0_ADDR, &s->pl330_irq_orgate[0],
-                 s->irq_table[exynos4210_get_irq(21, 0)], 32, 32, 32);
-    pl330_create(EXYNOS4210_PL330_BASE1_ADDR, &s->pl330_irq_orgate[1],
-                 s->irq_table[exynos4210_get_irq(21, 1)], 32, 32, 32);
-    pl330_create(EXYNOS4210_PL330_BASE2_ADDR, &s->pl330_irq_orgate[2],
-                 s->irq_table[exynos4210_get_irq(20, 1)], 1, 31, 64);
+    pl330[0] =3D pl330_create(EXYNOS4210_PL330_BASE0_ADDR,
+                            &s->pl330_irq_orgate[0],
+                            s->irq_table[exynos4210_get_irq(21, 0)],
+                            32, 32, 32);
+    pl330[1] =3D pl330_create(EXYNOS4210_PL330_BASE1_ADDR,
+                            &s->pl330_irq_orgate[1],
+                            s->irq_table[exynos4210_get_irq(21, 1)],
+                            32, 32, 32);
+    pl330[2] =3D pl330_create(EXYNOS4210_PL330_BASE2_ADDR,
+                            &s->pl330_irq_orgate[2],
+                            s->irq_table[exynos4210_get_irq(20, 1)],
+                            1, 31, 64);
+
+    sysbus_connect_irq(SYS_BUS_DEVICE(uart[0]), 1,
+                       qdev_get_gpio_in(pl330[0], 15));
+    sysbus_connect_irq(SYS_BUS_DEVICE(uart[1]), 1,
+                       qdev_get_gpio_in(pl330[1], 15));
+    sysbus_connect_irq(SYS_BUS_DEVICE(uart[2]), 1,
+                       qdev_get_gpio_in(pl330[0], 17));
+    sysbus_connect_irq(SYS_BUS_DEVICE(uart[3]), 1,
+                       qdev_get_gpio_in(pl330[1], 17));
 }
=20
 static void exynos4210_init(Object *obj)
--=20
2.20.1