From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144590959231.31565651106598; Mon, 9 Jul 2018 06:56:30 -0700 (PDT) Received: from localhost ([::1]:42192 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWeT-0000Qs-NA for importer@patchew.org; Mon, 09 Jul 2018 09:56:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48129) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWcj-0007eO-6I for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWci-00050v-F0 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:41 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43336) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWci-0004zS-7Q for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:40 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcf-0000gM-3Q for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:37 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:25 +0100 Message-Id: <20180709135435.836-2-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 01/11] hw/arm/smmu-common: Fix devfn computation in smmu_iommu_mr X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eric Auger smmu_iommu_mr() aims at returning the IOMMUMemoryRegion corresponding to a given sid. The function extracts both the PCIe bus number and the devfn to return this data. Current computation of devfn is wrong as it only returns the PCIe function instead of slot | function. Fixes 32cfd7f39e08 ("hw/arm/smmuv3: Cache/invalidate config data") Signed-off-by: Eric Auger Message-id: 1530775623-32399-1-git-send-email-eric.auger@redhat.com Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/hw/arm/smmu-common.h | 1 + hw/arm/smmu-common.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h index 50e2912a95e..b07cadd0ef9 100644 --- a/include/hw/arm/smmu-common.h +++ b/include/hw/arm/smmu-common.h @@ -24,6 +24,7 @@ =20 #define SMMU_PCI_BUS_MAX 256 #define SMMU_PCI_DEVFN_MAX 256 +#define SMMU_PCI_DEVFN(sid) (sid & 0xFF) =20 #define SMMU_MAX_VA_BITS 48 =20 diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c index 3098915d07c..55c75d65d2e 100644 --- a/hw/arm/smmu-common.c +++ b/hw/arm/smmu-common.c @@ -351,7 +351,7 @@ IOMMUMemoryRegion *smmu_iommu_mr(SMMUState *s, uint32_t= sid) bus_n =3D PCI_BUS_NUM(sid); smmu_bus =3D smmu_find_smmu_pcibus(s, bus_n); if (smmu_bus) { - devfn =3D sid & 0x7; + devfn =3D SMMU_PCI_DEVFN(sid); smmu =3D smmu_bus->pbdev[devfn]; if (smmu) { return &smmu->iommu; --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144864549195.09891286653897; Mon, 9 Jul 2018 07:01:04 -0700 (PDT) Received: from localhost ([::1]:42233 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWit-0004MK-1o for importer@patchew.org; Mon, 09 Jul 2018 10:01:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWci-0007eB-Q7 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWch-00050U-Hp for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:40 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43336) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWch-0004zS-93 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:39 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcf-0000h0-RN for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:37 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:26 +0100 Message-Id: <20180709135435.836-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 02/11] ptimer: Add TRIGGER_ONLY_ON_DECREMENT policy option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The CMSDK timer behaviour is that an interrupt is triggered when the counter counts down from 1 to 0; however one is not triggered if the counter is manually set to 0 by a guest write to the counter register. Currently ptimer can't handle this; add a policy option to allow a ptimer user to request this behaviour. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Guenter Roeck Message-id: 20180703171044.9503-2-peter.maydell@linaro.org --- include/hw/ptimer.h | 9 +++++++++ hw/core/ptimer.c | 22 +++++++++++++++++++++- tests/ptimer-test.c | 25 +++++++++++++++++++------ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/include/hw/ptimer.h b/include/hw/ptimer.h index fc4ef5cc1d2..0731d9aef19 100644 --- a/include/hw/ptimer.h +++ b/include/hw/ptimer.h @@ -69,6 +69,15 @@ * not the one less. */ #define PTIMER_POLICY_NO_COUNTER_ROUND_DOWN (1 << 4) =20 +/* + * Starting to run with a zero counter, or setting the counter to "0" via + * ptimer_set_count() or ptimer_set_limit() will not trigger the timer + * (though it will cause a reload). Only a counter decrement to "0" + * will cause a trigger. Not compatible with NO_IMMEDIATE_TRIGGER; + * ptimer_init() will assert() that you don't set both. + */ +#define PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT (1 << 5) + /* ptimer.c */ typedef struct ptimer_state ptimer_state; typedef void (*ptimer_cb)(void *opaque); diff --git a/hw/core/ptimer.c b/hw/core/ptimer.c index 7221c68a984..170fd34d8b5 100644 --- a/hw/core/ptimer.c +++ b/hw/core/ptimer.c @@ -45,8 +45,20 @@ static void ptimer_reload(ptimer_state *s, int delta_adj= ust) uint32_t period_frac =3D s->period_frac; uint64_t period =3D s->period; uint64_t delta =3D s->delta; + bool suppress_trigger =3D false; =20 - if (delta =3D=3D 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TR= IGGER)) { + /* + * Note that if delta_adjust is 0 then we must be here because of + * a count register write or timer start, not because of timer expiry. + * In that case the policy might require us to suppress the timer trig= ger + * that we would otherwise generate for a zero delta. + */ + if (delta_adjust =3D=3D 0 && + (s->policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT)) { + suppress_trigger =3D true; + } + if (delta =3D=3D 0 && !(s->policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TR= IGGER) + && !suppress_trigger) { ptimer_trigger(s); } =20 @@ -353,6 +365,14 @@ ptimer_state *ptimer_init(QEMUBH *bh, uint8_t policy_m= ask) s->bh =3D bh; s->timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, ptimer_tick, s); s->policy_mask =3D policy_mask; + + /* + * These two policies are incompatible -- trigger-on-decrement implies + * a timer trigger when the count becomes 0, but no-immediate-trigger + * implies a trigger when the count stops being 0. + */ + assert(!((policy_mask & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) && + (policy_mask & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER))); return s; } =20 diff --git a/tests/ptimer-test.c b/tests/ptimer-test.c index 41488896f76..b30aad07372 100644 --- a/tests/ptimer-test.c +++ b/tests/ptimer-test.c @@ -208,6 +208,7 @@ static void check_periodic(gconstpointer arg) bool no_immediate_trigger =3D (*policy & PTIMER_POLICY_NO_IMMEDIATE_TR= IGGER); bool no_immediate_reload =3D (*policy & PTIMER_POLICY_NO_IMMEDIATE_REL= OAD); bool no_round_down =3D (*policy & PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); + bool trig_only_on_dec =3D (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DEC= REMENT); =20 triggered =3D false; =20 @@ -311,7 +312,7 @@ static void check_periodic(gconstpointer arg) g_assert_cmpuint(ptimer_get_count(ptimer), =3D=3D, no_immediate_reload ? 0 : 10); =20 - if (no_immediate_trigger) { + if (no_immediate_trigger || trig_only_on_dec) { g_assert_false(triggered); } else { g_assert_true(triggered); @@ -506,6 +507,7 @@ static void check_run_with_delta_0(gconstpointer arg) bool no_immediate_trigger =3D (*policy & PTIMER_POLICY_NO_IMMEDIATE_TR= IGGER); bool no_immediate_reload =3D (*policy & PTIMER_POLICY_NO_IMMEDIATE_REL= OAD); bool no_round_down =3D (*policy & PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); + bool trig_only_on_dec =3D (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DEC= REMENT); =20 triggered =3D false; =20 @@ -515,7 +517,7 @@ static void check_run_with_delta_0(gconstpointer arg) g_assert_cmpuint(ptimer_get_count(ptimer), =3D=3D, no_immediate_reload ? 0 : 99); =20 - if (no_immediate_trigger) { + if (no_immediate_trigger || trig_only_on_dec) { g_assert_false(triggered); } else { g_assert_true(triggered); @@ -563,7 +565,7 @@ static void check_run_with_delta_0(gconstpointer arg) g_assert_cmpuint(ptimer_get_count(ptimer), =3D=3D, no_immediate_reload ? 0 : 99); =20 - if (no_immediate_trigger) { + if (no_immediate_trigger || trig_only_on_dec) { g_assert_false(triggered); } else { g_assert_true(triggered); @@ -609,6 +611,7 @@ static void check_periodic_with_load_0(gconstpointer ar= g) ptimer_state *ptimer =3D ptimer_init(bh, *policy); bool continuous_trigger =3D (*policy & PTIMER_POLICY_CONTINUOUS_TRIGGE= R); bool no_immediate_trigger =3D (*policy & PTIMER_POLICY_NO_IMMEDIATE_TR= IGGER); + bool trig_only_on_dec =3D (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DEC= REMENT); =20 triggered =3D false; =20 @@ -617,7 +620,7 @@ static void check_periodic_with_load_0(gconstpointer ar= g) =20 g_assert_cmpuint(ptimer_get_count(ptimer), =3D=3D, 0); =20 - if (no_immediate_trigger) { + if (no_immediate_trigger || trig_only_on_dec) { g_assert_false(triggered); } else { g_assert_true(triggered); @@ -667,6 +670,7 @@ static void check_oneshot_with_load_0(gconstpointer arg) QEMUBH *bh =3D qemu_bh_new(ptimer_trigger, NULL); ptimer_state *ptimer =3D ptimer_init(bh, *policy); bool no_immediate_trigger =3D (*policy & PTIMER_POLICY_NO_IMMEDIATE_TR= IGGER); + bool trig_only_on_dec =3D (*policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DEC= REMENT); =20 triggered =3D false; =20 @@ -675,7 +679,7 @@ static void check_oneshot_with_load_0(gconstpointer arg) =20 g_assert_cmpuint(ptimer_get_count(ptimer), =3D=3D, 0); =20 - if (no_immediate_trigger) { + if (no_immediate_trigger || trig_only_on_dec) { g_assert_false(triggered); } else { g_assert_true(triggered); @@ -725,6 +729,10 @@ static void add_ptimer_tests(uint8_t policy) g_strlcat(policy_name, "no_counter_rounddown,", 256); } =20 + if (policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) { + g_strlcat(policy_name, "trigger_only_on_decrement,", 256); + } + g_test_add_data_func_full( tmp =3D g_strdup_printf("/ptimer/set_count policy=3D%s", policy_na= me), g_memdup(&policy, 1), check_set_count, g_free); @@ -790,10 +798,15 @@ static void add_ptimer_tests(uint8_t policy) =20 static void add_all_ptimer_policies_comb_tests(void) { - int last_policy =3D PTIMER_POLICY_NO_COUNTER_ROUND_DOWN; + int last_policy =3D PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT; int policy =3D PTIMER_POLICY_DEFAULT; =20 for (; policy < (last_policy << 1); policy++) { + if ((policy & PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT) && + (policy & PTIMER_POLICY_NO_IMMEDIATE_TRIGGER)) { + /* Incompatible policy flag settings -- don't try to test them= */ + continue; + } add_ptimer_tests(policy); } } --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144741014537.2518560609057; Mon, 9 Jul 2018 06:59:01 -0700 (PDT) Received: from localhost ([::1]:42206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWgr-0002YZ-3t for importer@patchew.org; Mon, 09 Jul 2018 09:58:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWcj-0007eJ-0R for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWci-00050j-3h for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:41 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43338) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWch-00050D-Sf for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:40 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcg-0000hY-RQ for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:38 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:27 +0100 Message-Id: <20180709135435.836-4-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 03/11] hw/timer/cmsdk-apb-timer: Correct ptimer policy settings X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The CMSDK timer interrupt triggers when the counter goes from 1 to 0, so we want to trigger immediately, rather than waiting for a clock cycle. Drop the incorrect NO_IMMEDIATE_TRIGGER setting. We also do not want to get an interrupt if the guest sets the counter directly to zero, so use the new TRIGGER_ONLY_ON_DECREMENT policy. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Guenter Roeck Message-id: 20180703171044.9503-3-peter.maydell@linaro.org --- hw/timer/cmsdk-apb-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index 9878746609a..1f99081db1a 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -201,7 +201,7 @@ static void cmsdk_apb_timer_realize(DeviceState *dev, E= rror **errp) bh =3D qemu_bh_new(cmsdk_apb_timer_tick, s); s->timer =3D ptimer_init(bh, PTIMER_POLICY_WRAP_AFTER_ONE_PERIOD | - PTIMER_POLICY_NO_IMMEDIATE_TRIGGER | + PTIMER_POLICY_TRIGGER_ONLY_ON_DECREMENT | PTIMER_POLICY_NO_IMMEDIATE_RELOAD | PTIMER_POLICY_NO_COUNTER_ROUND_DOWN); =20 --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144745024233.84443703167312; Mon, 9 Jul 2018 06:59:05 -0700 (PDT) Received: from localhost ([::1]:42207 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWgq-0002ZN-Sq for importer@patchew.org; Mon, 09 Jul 2018 09:58:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWck-0007ex-7N for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWcj-00051V-4J for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43338) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWci-00050D-Tp for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:41 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWch-0000hm-KM for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:39 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:28 +0100 Message-Id: <20180709135435.836-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 04/11] hw/timer/cmsdk-apb-timer: Correctly identify and set one-shot mode X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Guenter Roeck The CMSDK APB timer is currently always configured as periodic timer. This results in the following messages when trying to boot Linux. Timer with delta zero, disabling If the timer limit set with the RELOAD command is 0, the timer needs to be enabled as one-shot timer. Signed-off-by: Guenter Roeck Reviewed-by: Richard Henderson Reviewed-by: Peter Maydell Tested-by: Guenter Roeck Signed-off-by: Peter Maydell --- hw/timer/cmsdk-apb-timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index 1f99081db1a..3ebdc7be408 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -119,7 +119,7 @@ static void cmsdk_apb_timer_write(void *opaque, hwaddr = offset, uint64_t value, } s->ctrl =3D value & 0xf; if (s->ctrl & R_CTRL_EN_MASK) { - ptimer_run(s->timer, 0); + ptimer_run(s->timer, ptimer_get_limit(s->timer) =3D=3D 0); } else { ptimer_stop(s->timer); } --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144994358212.65628669974342; Mon, 9 Jul 2018 07:03:14 -0700 (PDT) Received: from localhost ([::1]:42247 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWkz-0005aj-Ct for importer@patchew.org; Mon, 09 Jul 2018 10:03:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48164) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWck-0007fF-Ha for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWcj-00051s-Jy for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWcj-00051K-Cx for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:41 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWci-0000iL-Cd for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:40 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:29 +0100 Message-Id: <20180709135435.836-6-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 05/11] hw/timer/cmsdk-apb-timer: run or stop timer on writes to RELOAD and VALUE X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" If the CMSDK APB timer is set up with a zero RELOAD value then it will count down to zero, fire once and then stay at zero. From the point of view of the ptimer system, the timer is disabled; but the enable bit in the CTRL register is still set and if the guest subsequently writes to the RELOAD or VALUE registers this should cause the timer to start counting down again. Add code to the write paths for RELOAD and VALUE so that we correctly restart the timer in this situation. Conversely, if the new RELOAD and VALUE are both zero, we should stop the ptimer. Signed-off-by: Peter Maydell Reviewed-by: Richard Henderson Tested-by: Guenter Roeck Message-id: 20180703171044.9503-5-peter.maydell@linaro.org --- hw/timer/cmsdk-apb-timer.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/timer/cmsdk-apb-timer.c b/hw/timer/cmsdk-apb-timer.c index 3ebdc7be408..801d1dba741 100644 --- a/hw/timer/cmsdk-apb-timer.c +++ b/hw/timer/cmsdk-apb-timer.c @@ -126,10 +126,26 @@ static void cmsdk_apb_timer_write(void *opaque, hwadd= r offset, uint64_t value, break; case A_RELOAD: /* Writing to reload also sets the current timer value */ + if (!value) { + ptimer_stop(s->timer); + } ptimer_set_limit(s->timer, value, 1); + if (value && (s->ctrl & R_CTRL_EN_MASK)) { + /* + * Make sure timer is running (it might have stopped if this + * was an expired one-shot timer) + */ + ptimer_run(s->timer, 0); + } break; case A_VALUE: + if (!value && !ptimer_get_limit(s->timer)) { + ptimer_stop(s->timer); + } ptimer_set_count(s->timer, value); + if (value && (s->ctrl & R_CTRL_EN_MASK)) { + ptimer_run(s->timer, ptimer_get_limit(s->timer) =3D=3D 0); + } break; case A_INTSTATUS: /* Just one bit, which is W1C. */ --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144594226677.6750608748226; Mon, 9 Jul 2018 06:56:34 -0700 (PDT) Received: from localhost ([::1]:42193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWeX-0000Uf-34 for importer@patchew.org; Mon, 09 Jul 2018 09:56:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWcl-0007fr-CI for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWck-00052b-NA for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:43 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43340) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWck-00051K-9w for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcj-0000iu-4l for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:41 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:30 +0100 Message-Id: <20180709135435.836-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 06/11] target/arm: Suppress Coverity warning for PRF X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Richard Henderson These instructions must perform the sve_access_check, but since they are implemented as NOPs there is no generated code to elide when the access check fails. Fixes: Coverity issues 1393780 & 1393779. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- target/arm/translate-sve.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index c080345b9c7..d41f1155f91 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -5164,7 +5164,7 @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_z= piz *a, uint32_t insn) static bool trans_PRF(DisasContext *s, arg_PRF *a, uint32_t insn) { /* Prefetch is a nop within QEMU. */ - sve_access_check(s); + (void)sve_access_check(s); return true; } =20 @@ -5174,7 +5174,7 @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr = *a, uint32_t insn) return false; } /* Prefetch is a nop within QEMU. */ - sve_access_check(s); + (void)sve_access_check(s); return true; } =20 --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144869138607.4618323285894; Mon, 9 Jul 2018 07:01:09 -0700 (PDT) Received: from localhost ([::1]:42234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWit-0004MO-Q2 for importer@patchew.org; Mon, 09 Jul 2018 10:01:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWcl-0007gG-Nc for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWcl-00052u-1A for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:43 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWck-00052E-Qk for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:42 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcj-0000jd-R4 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:41 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:31 +0100 Message-Id: <20180709135435.836-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-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: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 07/11] tcg: Restrict check_size_impl to multiples of the line size X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Richard Henderson Normally this is automatic in the size restrictions that are placed on vector sizes coming from the implementation. However, for the legitimate size tuple [oprsz=3D8, maxsz=3D32], we need to clear the final 24 bytes of the vector register. Without this check, do_dup selects TCG_TYPE_V128 and clears only 16 bytes. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e Message-id: 20180705191929.30773-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- tcg/tcg-op-gvec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c index 22db1590d5d..61c25f57841 100644 --- a/tcg/tcg-op-gvec.c +++ b/tcg/tcg-op-gvec.c @@ -287,8 +287,11 @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, = uint32_t bofs, in units of LNSZ. This limits the expansion of inline code. */ static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz) { - uint32_t lnct =3D oprsz / lnsz; - return lnct >=3D 1 && lnct <=3D MAX_UNROLL; + if (oprsz % lnsz =3D=3D 0) { + uint32_t lnct =3D oprsz / lnsz; + return lnct >=3D 1 && lnct <=3D MAX_UNROLL; + } + return false; } =20 static void expand_clr(uint32_t dofs, uint32_t maxsz); --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531145101139928.2093024666386; Mon, 9 Jul 2018 07:05:01 -0700 (PDT) Received: from localhost ([::1]:42264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWmc-0006Yb-0p for importer@patchew.org; Mon, 09 Jul 2018 10:04:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48215) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWcm-0007hO-NF for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWcl-00053a-VA for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:44 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43342) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWcl-00052E-OF for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:43 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWck-0000js-Hp for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:42 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:32 +0100 Message-Id: <20180709135435.836-9-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-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: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 08/11] target/arm: Fix do_predset for large VL X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Richard Henderson Use MAKE_64BIT_MASK instead of open-coding. Remove an odd vector size check that is unlikely to be more profitable than 3 64-bit integer stores. Correct the iteration for WORD to avoid writing too much data. Fixes RISU tests of PTRUE for VL 256. Signed-off-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Tested-by: Alex Benn=C3=A9e Message-id: 20180705191929.30773-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/translate-sve.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index d41f1155f91..374051cd20a 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1438,7 +1438,7 @@ static bool do_predset(DisasContext *s, int esz, int = rd, int pat, bool setflag) setsz =3D numelem << esz; lastword =3D word =3D pred_esz_masks[esz]; if (setsz % 64) { - lastword &=3D ~(-1ull << (setsz % 64)); + lastword &=3D MAKE_64BIT_MASK(0, setsz % 64); } } =20 @@ -1457,19 +1457,13 @@ static bool do_predset(DisasContext *s, int esz, in= t rd, int pat, bool setflag) tcg_gen_gvec_dup64i(ofs, oprsz, maxsz, word); goto done; } - if (oprsz * 8 =3D=3D setsz + 8) { - tcg_gen_gvec_dup64i(ofs, oprsz, maxsz, word); - tcg_gen_movi_i64(t, 0); - tcg_gen_st_i64(t, cpu_env, ofs + oprsz - 8); - goto done; - } } =20 setsz /=3D 8; fullsz /=3D 8; =20 tcg_gen_movi_i64(t, word); - for (i =3D 0; i < setsz; i +=3D 8) { + for (i =3D 0; i < QEMU_ALIGN_DOWN(setsz, 8); i +=3D 8) { tcg_gen_st_i64(t, cpu_env, ofs + i); } if (lastword !=3D word) { --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144994057632.1740981949678; Mon, 9 Jul 2018 07:03:14 -0700 (PDT) Received: from localhost ([::1]:42248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWkz-0005b1-0e for importer@patchew.org; Mon, 09 Jul 2018 10:03:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48233) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWcn-0007i8-KA for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWcm-000543-Jy for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:45 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWcm-00053K-Bs for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:44 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcl-0000kZ-9C for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:43 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:33 +0100 Message-Id: <20180709135435.836-10-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-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: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 09/11] hw/sd/omap_mmc: Split 'pseudo-reset' from 'power-on-reset' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Philippe Mathieu-Daud=C3=A9 DeviceClass::reset models a "cold power-on" reset which can also be used to powercycle a device; but there is no "hot reset" (a.k.a. soft-reset) method available. The OMAP MMC Power-Up Control bit is not designed to powercycle a card, but to disable it without powering it off (pseudo-reset): Multimedia Card (MMC/SD/SDIO) Interface [SPRU765A] MMC_CON[11] Power-Up Control (POW) This bit must be set to 1 before any valid transaction to either MMC/SD or SPI memory cards. When 1, the card is considered powered-up and the controller core is enabled. When 0, the card is considered powered-down (system dependent), and the controller core logic is in pseudo-reset state. This is, the MMC_STAT flags and the FIFO pointers are reset, any access to MMC_DATA[DATA] has no effect, a write into the MMC.CMD register is ignored, and a setting of MMC_SPI[STR] to 1 is ignored. By splitting the 'pseudo-reset' code out of the 'power-on' reset function, this patch fixes a latent bug in omap_mmc_write(MMC_CON)i recently exposed by ecd219f7abb. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20180706162155.8432-2-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/sd/omap_mmc.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hw/sd/omap_mmc.c b/hw/sd/omap_mmc.c index 671264b6500..d0c98ca0214 100644 --- a/hw/sd/omap_mmc.c +++ b/hw/sd/omap_mmc.c @@ -1,6 +1,8 @@ /* * OMAP on-chip MMC/SD host emulation. * + * Datasheet: TI Multimedia Card (MMC/SD/SDIO) Interface (SPRU765A) + * * Copyright (C) 2006-2007 Andrzej Zaborowski * * This program is free software; you can redistribute it and/or @@ -278,6 +280,12 @@ static void omap_mmc_update(void *opaque) omap_mmc_interrupts_update(s); } =20 +static void omap_mmc_pseudo_reset(struct omap_mmc_s *host) +{ + host->status =3D 0; + host->fifo_len =3D 0; +} + void omap_mmc_reset(struct omap_mmc_s *host) { host->last_cmd =3D 0; @@ -286,11 +294,9 @@ void omap_mmc_reset(struct omap_mmc_s *host) host->dw =3D 0; host->mode =3D 0; host->enable =3D 0; - host->status =3D 0; host->mask =3D 0; host->cto =3D 0; host->dto =3D 0; - host->fifo_len =3D 0; host->blen =3D 0; host->blen_counter =3D 0; host->nblk =3D 0; @@ -305,6 +311,8 @@ void omap_mmc_reset(struct omap_mmc_s *host) qemu_set_irq(host->coverswitch, host->cdet_state); host->clkdiv =3D 0; =20 + omap_mmc_pseudo_reset(host); + /* Since we're still using the legacy SD API the card is not plugged * into any bus, and we must reset it manually. When omap_mmc is * QOMified this must move into the QOM reset function. @@ -459,7 +467,7 @@ static void omap_mmc_write(void *opaque, hwaddr offset, if (s->dw !=3D 0 && s->lines < 4) printf("4-bit SD bus enabled\n"); if (!s->enable) - omap_mmc_reset(s); + omap_mmc_pseudo_reset(s); break; =20 case 0x10: /* MMC_STAT */ --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531144745014312.40309203585764; Mon, 9 Jul 2018 06:59:05 -0700 (PDT) Received: from localhost ([::1]:42208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWgu-0002bq-9o for importer@patchew.org; Mon, 09 Jul 2018 09:59:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWco-0007jA-Bc for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWcn-00054W-Hz for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:46 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWcn-00053K-AM for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:45 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcm-0000l2-0r for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:44 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:34 +0100 Message-Id: <20180709135435.836-11-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 10/11] boards.h: Remove doc comment reference to nonexistent function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" commit b08199c6fbea1 accidentally added a reference to a doc comment to a nonexistent memory_region_allocate_aux_memory(). This was a leftover from a previous version of the patchset which defined memory_region_allocate_aux_memory() for "allocate RAM MemoryRegion and register it for migration" and left "memory_region_init_ram()" with its original semantics of "allocate RAM MR but do not register for migration". In the end we decided on the approach of "memory_region_init_ram() registers the MR for migration, and memory_region_init_ram_nomigrate() is a new function which does not", but this comment change got left in by mistake. Revert that part of the commit. Reported-by: Thomas Huth Signed-off-by: Peter Maydell Message-id: 20180702130605.13611-1-peter.maydell@linaro.org --- include/hw/boards.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index 79069ddcbec..d139a431a67 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -35,8 +35,7 @@ * * Smaller pieces of memory (display RAM, static RAMs, etc) don't need * to be backed via the -mem-path memory backend and can simply - * be created via memory_region_allocate_aux_memory() or - * memory_region_init_ram(). + * be created via memory_region_init_ram(). */ void memory_region_allocate_system_memory(MemoryRegion *mr, Object *owner, const char *name, --=20 2.17.1 From nobody Sat Feb 7 05:25:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1531145188405128.93221962978146; Mon, 9 Jul 2018 07:06:28 -0700 (PDT) Received: from localhost ([::1]:42272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWo1-0007Dy-B9 for importer@patchew.org; Mon, 09 Jul 2018 10:06:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fcWco-0007jh-Q2 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fcWcn-00054o-W9 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:46 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:43346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fcWcn-00054N-Pk for qemu-devel@nongnu.org; Mon, 09 Jul 2018 09:54:45 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fcWcm-0000lW-O0 for qemu-devel@nongnu.org; Mon, 09 Jul 2018 14:54:44 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jul 2018 14:54:35 +0100 Message-Id: <20180709135435.836-12-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180709135435.836-1-peter.maydell@linaro.org> References: <20180709135435.836-1-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 11/11] hw/net/dp8393x: don't make prom region 'nomigrate' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currently we use memory_region_init_rom_nomigrate() to create the "dp3893x-prom" memory region, and we don't manually register it with vmstate_register_ram(). This currently means that its contents are migrated but as a ram block whose name is the empty string; in future it may mean they are not migrated at all. Use memory_region_init_ram() instead. Note that this is a a cross-version migration compatibility break for the MIPS "magnum" and "pica61" machines. Signed-off-by: Peter Maydell Reviewed-by: Aleksandar Markovic Message-id: 20180706174309.27110-1-peter.maydell@linaro.org --- hw/net/dp8393x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index f2d2ce344cc..b53fcaa8bc3 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -887,7 +887,7 @@ static void dp8393x_realize(DeviceState *dev, Error **e= rrp) s->watchdog =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s); s->regs[SONIC_SR] =3D 0x0004; /* only revision recognized by Linux */ =20 - memory_region_init_ram_nomigrate(&s->prom, OBJECT(dev), + memory_region_init_ram(&s->prom, OBJECT(dev), "dp8393x-prom", SONIC_PROM_SIZE, &local_err); if (local_err) { error_propagate(errp, local_err); --=20 2.17.1