From nobody Fri May 17 02:41:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1590947874; cv=none; d=zohomail.com; s=zohoarc; b=eqpTOBKnCiOaoJMydf8ZDBzTK/aBif03W+0R1ZUb0mPTlVOLRiXIBG5spAaHdwqVYDbTzRRRrtl4weht1DbHiGr7dOBn9cSZXxbIE2+uKVpHxIuaqHa1/YkEFc22Rqz3O/hbSoSVX+qdR6oU9xAScJwqTGAM7YDsTVm0EamPbOQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590947874; h=Content-Type:Content-Transfer-Encoding:Cc: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=1hu7DwCrcdSlatzn9Imjz1Afklu0mU2pvXW+JIC/CUI=; b=n09OlgiYsEzrz21cC9h5ZdckJLl8z5qcLnKSk50S1HqiLeq3e9nZkmfLCkoCdRH+yZwQYTZke46Gl3SfLjk4sk9pNs5G0xSTg/Kd8KAZx5o4qMp3kfbrbSf8wLJP28BKdRHMweN03rWKfYhiYQjOgNxy4jjgW749SwuIWYny4bU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590947874008846.4980294496753; Sun, 31 May 2020 10:57:54 -0700 (PDT) Received: from localhost ([::1]:53056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSDY-0008VA-NG for importer@patchew.org; Sun, 31 May 2020 13:57:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSAK-0003c5-4h; Sun, 31 May 2020 13:54:32 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:51294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfSAJ-0007b5-FL; Sun, 31 May 2020 13:54:31 -0400 Received: by mail-wm1-x343.google.com with SMTP id u13so8639648wml.1; Sun, 31 May 2020 10:54:30 -0700 (PDT) Received: from localhost.localdomain (43.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.43]) by smtp.gmail.com with ESMTPSA id z7sm17862531wrt.6.2020.05.31.10.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 10:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1hu7DwCrcdSlatzn9Imjz1Afklu0mU2pvXW+JIC/CUI=; b=mWlqM6b9/BHwoA0IIMk6EvG4IZKUZy+M481W1L5fMaOfUoAyf/oZyIEBcI0p/rJ2Pm T5O4FDD2RyR3+NG8/mMcWThSQLF4wc/XQ5gGD7cqZc14u5qfccO/MQbI6He6SE4qyIMI iv+XlwkMhYfWyV3uJYfbftwElcMfVdNhdhHEe6/fDglOPOJkl4T91adYLY7phf1lgO2T yJsEGJvdRYr6H/hPsVQyJpQI5Jm+1A7XORDd9kfbh/NO8xYkfz4XO1Q8z4v8CGBbN2zr 3O+ckKK4GC5B+UpvXC2yK+K9Xximkm2CDxwE0QjBG4dTqV/Ucb7yfNbpwCgJEHXFXcn1 hwkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=1hu7DwCrcdSlatzn9Imjz1Afklu0mU2pvXW+JIC/CUI=; b=N6U+bbW77VvrKRBOkH/w4JsagbY+L0HaLZ9CxwaAoGNHRc0IH7kjiCCyFLsCVseOLt BIEKvovbF9pwXAOF+sj4EhN4pj7cBZcUlAyTyFXx0j9lkvP2A8kiPDxCLfm3NmOPhCOx 8LWkiOq+K+aDIwuHEYbRRjdJQ/DsNNigdnIlc/zElcOWuIJ5b6erG08+eoxJJ1RVLK+G Pdw5EppL2vUoQ9ytyyD5q2ZOyJey0ybEW3GvRoRzGBZ4ink+S/QMJ2RkEEH0zLjNqQuF mfCCwUp0sY327zRUPQ+okQ1q7Y7mMl3BgeI0gkZzCRHLiez1TDgURVCTXRIxfp6tGsHn VNJA== X-Gm-Message-State: AOAM533VKbHUboMGaZn796sxEzxtOS39oEbHwl7nYvIiDV/ptTWk96s9 GLRxrb+rHjS2MbDCukYsusG3TCQ2 X-Google-Smtp-Source: ABdhPJzz/ulACo/1WfFbWBit9hOLo0uQYfC6wcVx9x4bYnRdwzQ1IZ7kqd652hpHKAlYEM6mooyAWA== X-Received: by 2002:a1c:c2c5:: with SMTP id s188mr18162355wmf.18.1590947669222; Sun, 31 May 2020 10:54:29 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 1/6] target/s390x/mmu_helper: Use address_space_rw() in place Date: Sun, 31 May 2020 19:54:20 +0200 Message-Id: <20200531175425.10329-2-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200531175425.10329-1-f4bug@amsat.org> References: <20200531175425.10329-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , David Hildenbrand , Cornelia Huck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Beniamino Galvani , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) In an effort to remove the cpu_physical_memory_rw() API, update s390_cpu_virt_mem_rw() to use a more recent address_space_rw() API. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: David Hildenbrand --- target/s390x/mmu_helper.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index 7d9f3059cd..632e8a8af4 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -529,8 +529,10 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, ui= nt8_t ar, void *hostbuf, /* Copy data by stepping through the area page by page */ for (i =3D 0; i < nr_pages; i++) { currlen =3D MIN(len, TARGET_PAGE_SIZE - (laddr % TARGET_PAGE_S= IZE)); - cpu_physical_memory_rw(pages[i] | (laddr & ~TARGET_PAGE_MASK), - hostbuf, currlen, is_write); + address_space_rw(CPU(cpu)->as, + pages[i] | (laddr & ~TARGET_PAGE_MASK), + MEMTXATTRS_UNSPECIFIED, + hostbuf, currlen, is_write); laddr +=3D currlen; hostbuf +=3D currlen; len -=3D currlen; --=20 2.21.3 From nobody Fri May 17 02:41:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1590947763; cv=none; d=zohomail.com; s=zohoarc; b=iRr+MpXDGoeK2HzsXuSx2BWfpnVlJSMr849QfKJsYj1zzD9s55kEG5bnFJV9DL32f5QmOf9j6cQ25IKavHpZI8VISofZWBRVV0J7py76G1YJf/E9pOfNdr4bcK1+/bYBYzN0FN3QedIeRiVHu82cCIwfkt6KofLW6rP4wav8Pto= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590947763; h=Content-Type:Content-Transfer-Encoding:Cc: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=DBQUDGRuCGTWntTIf+/3MDtftJR4gTvYShUP8HbRMhY=; b=aGOxuavq25HizElkmSzkJAWnj79dZ99bsoKiK4p6zAND4MyuiPTDzZJ6mraG8gsRabj4coycxVtCv9fryRBrObN5wPxrBe+RP5+TbQqHQiMd1mY+3yEyUx/nY69F2uh4ioJCAQ3WA4/QXytIlZ1kTopdfeo2flJGPgWUN6sivdY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590947763572173.98294950617048; Sun, 31 May 2020 10:56:03 -0700 (PDT) Received: from localhost ([::1]:44786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSBm-00055H-2u for importer@patchew.org; Sun, 31 May 2020 13:56:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSAL-0003cM-ME; Sun, 31 May 2020 13:54:33 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:38983) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfSAK-0007cs-Pn; Sun, 31 May 2020 13:54:33 -0400 Received: by mail-wr1-x443.google.com with SMTP id t18so9214904wru.6; Sun, 31 May 2020 10:54:31 -0700 (PDT) Received: from localhost.localdomain (43.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.43]) by smtp.gmail.com with ESMTPSA id z7sm17862531wrt.6.2020.05.31.10.54.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 10:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=DBQUDGRuCGTWntTIf+/3MDtftJR4gTvYShUP8HbRMhY=; b=P1bjHqaZWE44yroDGPGV25akgfIYjPuGLihF6RHZT8HDl0TtROZ3yDCm/0dxAPMmHW YIdgBhJiTUjWhFMYt0AIoLqQuiVw/Og550Qk9OJ8FcB0/lljfXf1P5LcVNgZhpivblTK soCIirx7gqk9sv6jnMLtuBkamYEljqIYgXVnTjxA7yz/K7j0D2FEDl7myIIkm8IOZ+BH Cud28U4PmnaaEg9atppXL0QUD0siM4OIMridWgG1qbLhM4GMBbZYSs7IAZm//dftOBcV E0eG0xuoSia7GTR4BvwpIAwxX603cNi/mJNc99NsA373ECpUZ3AgcyAy03XvOZgO7brj 9N7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=DBQUDGRuCGTWntTIf+/3MDtftJR4gTvYShUP8HbRMhY=; b=DlzuR43D1nG9vyjA0rNQ+TNqpVFzIUlrvi2f/9vEwwEPosLHtWXYC42GlzRqRLrXsi atZ9DEs9SdKBpefF312n1lCtR0zbtaRsDew7QSTBey8CfDEy8PotjngNNGPxUkdvrXx5 aF8oyj4aPt/GPqllM++cA7p5oNVvaiIDsB1KV8UkyZcQVmBm1ud4fp96fI4arZy1FyMx 9YBy9PHSYVGnXnYVFGAmP8tzVuylQtuaSL9TG2F0CFog9eAjgrI5ypJzrxPlDyoRhr/b sqPRW4VyUOOM3tGV/nlAOtINpJZu+XMDtWUEOaB+1JPlRPxAW29ArGJeyeXRsGNZ3FY5 VQ+Q== X-Gm-Message-State: AOAM532ewBwPOZlzg9bdVcpuM6VkGMstE3wcYjlyRwlEh+7QKIS+3N2X BK84g1l1Pkusv2ikRPWdouLxe2eV X-Google-Smtp-Source: ABdhPJytI2CNMDNjMq8ZFRMNVmEv8gdBBAxqVsiqsYyIK0qBiIp1jl4HClPeskoN0yIUV2a0GsdPFA== X-Received: by 2002:adf:b354:: with SMTP id k20mr18343908wrd.412.1590947670503; Sun, 31 May 2020 10:54:30 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 2/6] hw/dma/rc4030: Use DMA address space to do DMA accesses Date: Sun, 31 May 2020 19:54:21 +0200 Message-Id: <20200531175425.10329-3-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200531175425.10329-1-f4bug@amsat.org> References: <20200531175425.10329-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , David Hildenbrand , Cornelia Huck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Beniamino Galvani , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The DMA device should not use the CPU address space to do its operation, but its own address space. Replace cpu_physical_memory_write() by dma_memory_read() since we already have the DMA address space available. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/dma/rc4030.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index eefbabd758..c39fe2bb69 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" +#include "sysemu/dma.h" #include "hw/irq.h" #include "hw/mips/mips.h" #include "hw/sysbus.h" @@ -301,7 +302,7 @@ static void rc4030_write(void *opaque, hwaddr addr, uin= t64_t data, if (s->cache_ltag =3D=3D 0x80000001 && s->cache_bmask =3D=3D 0xf0f= 0f0f) { hwaddr dest =3D s->cache_ptag & ~0x1; dest +=3D (s->cache_maint & 0x3) << 3; - cpu_physical_memory_write(dest, &val, 4); + dma_memory_read(&s->dma_as, dest, &val, 4); } break; /* Remote Speed Registers */ --=20 2.21.3 From nobody Fri May 17 02:41:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=amsat.org ARC-Seal: i=1; a=rsa-sha256; t=1590947789; cv=none; d=zohomail.com; s=zohoarc; b=Z3/QG9zUGuemjtYi4ewygaPvJ8PAAw/gaKe7KHkk4dsC+9MazhGMR0uM+EowEGjQPr7f641YleA9vWKFu1enxyClBwUKWnJaVxPs9XGqQsIzVkBpPngUqpGXWrN/yZytWumvf8gxBoi+iIG7+AGO2/E8ph62MV+rMKRF3jYV/pw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590947789; h=Content-Type:Content-Transfer-Encoding:Cc: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=Dvh9ZlB2YzrPmnRo8g2PXiL+qQpysab7ZLFeTg1BN6M=; b=PjcL8H/7LWrOz6fxVFrH69s8OX0clo3OTACHHhhJV9BVgtijIHyDjhchmP1prnaOdbCF/0Xk7mIqQ2JoaxwOW7DrjK9FHrFRCQNRYMK8czNyQHy+wWiYZy7l9QP7mizcKoGmNHpARUceRM+Bp+P/IrKzVeAPx5/2ikc3DYIMjyk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590947789443297.40930616797914; Sun, 31 May 2020 10:56:29 -0700 (PDT) Received: from localhost ([::1]:45948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSCC-0005c5-7y for importer@patchew.org; Sun, 31 May 2020 13:56:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSAM-0003cm-SH; Sun, 31 May 2020 13:54:34 -0400 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]:41815) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfSAM-0007dB-40; Sun, 31 May 2020 13:54:34 -0400 Received: by mail-wr1-x444.google.com with SMTP id j10so9178453wrw.8; Sun, 31 May 2020 10:54:33 -0700 (PDT) Received: from localhost.localdomain (43.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.43]) by smtp.gmail.com with ESMTPSA id z7sm17862531wrt.6.2020.05.31.10.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 10:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Dvh9ZlB2YzrPmnRo8g2PXiL+qQpysab7ZLFeTg1BN6M=; b=m5FOWe+F0mJ3nRIzM6rEIVG4pL/paYIdc8LcC9s2mubExfLa4bP3mScZBfKAFFlUCY HIqNbm/Vk8F60YK32Vz5eWU63PJnA7aRiqMKB/qFdoCCcHoWyRMkgA2E2LqMbwO2ckVj fTEaC20FNMY/T0tAD71jDyN01kpx80Zbu/eS5yqISplqbdq9UPpALGcov8FUJlUjd3KE DHKOk31OCux1I5V1zczEOUvOlx/137Jy4+Z45uKvwV5TrvH1p9KFohLM+iMpYwCwPVYw qUU6gpbMU2tX5oLZjKVyyupdBFhAEH6MAGTUQ7OV9snrozylipWc5p0/+xU2SeRLcd4Q R6vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Dvh9ZlB2YzrPmnRo8g2PXiL+qQpysab7ZLFeTg1BN6M=; b=WozwpQOKYax+UDpJUplxUnxehVv3UZcnd3vT3kahvGWeKZ60ooqkvAq/6XhY6rX6gm N4Ie8y8z/zvhs9DVyu47vCviVroyE8G1nJ0fSMhj9HeMhhTifSgINiGNO76Chc8mKtJz 3w8zTR24u71i6RZmVANbyne6Z8z1UG4h1BSoj7w7iJrwWZlwiEsb9LX42rg+vACI4cvr kFsxkuq+eMU1tZjKdCRBoZM/EJN9qSRGlwsDPr45wVCStIxVQy6BCLE5LsvxOt/WKQSg mbQk8a1hs7fZd3gbC1MvEopfpcRKVExYAPsWY7VFybrv82jK+gsCF0cifuAYBRuIQSM8 A4Kw== X-Gm-Message-State: AOAM532jJYtMK+eAoVqcP3YzzKGssoKND5vHy4cvacQ4L1O/p5hZjb6M GYil6mFqaSO91fs0Ey/knIV/IDGo X-Google-Smtp-Source: ABdhPJz1GxV/uSud2mIcv0IYegcyrgtYn8yN7VsULEQJnNJnzS/9BP3ki2V6Kb4lwBWxdAKacleCzg== X-Received: by 2002:a5d:6283:: with SMTP id k3mr17748351wru.422.1590947671873; Sun, 31 May 2020 10:54:31 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 3/6] hw/sd/allwinner-sdhost: Do DMA accesses via DMA address space Date: Sun, 31 May 2020 19:54:22 +0200 Message-Id: <20200531175425.10329-4-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200531175425.10329-1-f4bug@amsat.org> References: <20200531175425.10329-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::444; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x444.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , David Hildenbrand , Cornelia Huck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Beniamino Galvani , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The DMA operations should not use the CPU address space, but the DMA address space. Add support for a DMA address space, and replace the cpu_physical_memory API calls by equivalent dma_memory_read/write calls. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/hw/sd/allwinner-sdhost.h | 4 ++++ hw/sd/allwinner-sdhost.c | 36 ++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/include/hw/sd/allwinner-sdhost.h b/include/hw/sd/allwinner-sdh= ost.h index d94606a853..ae1125c026 100644 --- a/include/hw/sd/allwinner-sdhost.h +++ b/include/hw/sd/allwinner-sdhost.h @@ -68,6 +68,10 @@ typedef struct AwSdHostState { /** Maps I/O registers in physical memory */ MemoryRegion iomem; =20 + /** DMA physical memory */ + MemoryRegion *dma_mr; + AddressSpace dma_as; + /** Interrupt output signal to notify CPU */ qemu_irq irq; =20 diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c index f404e1fdb4..9a2b5fcaeb 100644 --- a/hw/sd/allwinner-sdhost.c +++ b/hw/sd/allwinner-sdhost.c @@ -21,7 +21,10 @@ #include "qemu/log.h" #include "qemu/module.h" #include "qemu/units.h" +#include "qapi/error.h" #include "sysemu/blockdev.h" +#include "sysemu/dma.h" +#include "hw/qdev-properties.h" #include "hw/irq.h" #include "hw/sd/allwinner-sdhost.h" #include "migration/vmstate.h" @@ -306,7 +309,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostS= tate *s, uint8_t buf[1024]; =20 /* Read descriptor */ - cpu_physical_memory_read(desc_addr, desc, sizeof(*desc)); + dma_memory_read(&s->dma_as, desc_addr, desc, sizeof(*desc)); if (desc->size =3D=3D 0) { desc->size =3D klass->max_desc_size; } else if (desc->size > klass->max_desc_size) { @@ -331,8 +334,9 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostS= tate *s, =20 /* Write to SD bus */ if (is_write) { - cpu_physical_memory_read((desc->addr & DESC_SIZE_MASK) + num_d= one, - buf, buf_bytes); + dma_memory_read(&s->dma_as, + (desc->addr & DESC_SIZE_MASK) + num_done, + buf, buf_bytes); =20 for (uint32_t i =3D 0; i < buf_bytes; i++) { sdbus_write_data(&s->sdbus, buf[i]); @@ -343,15 +347,16 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHos= tState *s, for (uint32_t i =3D 0; i < buf_bytes; i++) { buf[i] =3D sdbus_read_data(&s->sdbus); } - cpu_physical_memory_write((desc->addr & DESC_SIZE_MASK) + num_= done, - buf, buf_bytes); + dma_memory_write(&s->dma_as, + (desc->addr & DESC_SIZE_MASK) + num_done, + buf, buf_bytes); } num_done +=3D buf_bytes; } =20 /* Clear hold flag and flush descriptor */ desc->status &=3D ~DESC_STATUS_HOLD; - cpu_physical_memory_write(desc_addr, desc, sizeof(*desc)); + dma_memory_write(&s->dma_as, desc_addr, desc, sizeof(*desc)); =20 return num_done; } @@ -742,6 +747,17 @@ static void allwinner_sdhost_init(Object *obj) sysbus_init_irq(SYS_BUS_DEVICE(s), &s->irq); } =20 +static void allwinner_sdhost_realize(DeviceState *dev, Error **errp) +{ + AwSdHostState *s =3D AW_SDHOST(dev); + + if (!s->dma_mr) { + error_setg(errp, "\"dma\" property must be provided."); + return; + } + address_space_init(&s->dma_as, s->dma_mr, "sdhost-dma"); +} + static void allwinner_sdhost_reset(DeviceState *dev) { AwSdHostState *s =3D AW_SDHOST(dev); @@ -787,6 +803,12 @@ static void allwinner_sdhost_reset(DeviceState *dev) s->status_crc =3D REG_SD_CRC_STA_RST; } =20 +static Property allwinner_sdhost_properties[] =3D { + DEFINE_PROP_LINK("dma", AwSdHostState, + dma_mr, TYPE_MEMORY_REGION, MemoryRegion *), + DEFINE_PROP_END_OF_LIST(), +}; + static void allwinner_sdhost_bus_class_init(ObjectClass *klass, void *data) { SDBusClass *sbc =3D SD_BUS_CLASS(klass); @@ -798,7 +820,9 @@ static void allwinner_sdhost_class_init(ObjectClass *kl= ass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 + device_class_set_props(dc, allwinner_sdhost_properties); dc->reset =3D allwinner_sdhost_reset; + dc->realize =3D allwinner_sdhost_realize; dc->vmsd =3D &vmstate_allwinner_sdhost; } =20 --=20 2.21.3 From nobody Fri May 17 02:41:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1590947975; cv=none; d=zohomail.com; s=zohoarc; b=P1nbOuI95wk2zRH+MwBHXSUEB+znHjBRKXwe+7yLznAec/ez8Z94vOfH2LRhm7Qn8AbC+KPlrvBqr0467VfmFdaoRuStWunZEjkqSUbtdcshkGgqeBQCtqzUUMHhxe6S+sEnsvdysyFFcviRh+qElFqYoCfuGZSyYGKyFR0GHjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590947975; h=Content-Type:Content-Transfer-Encoding:Cc: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=RUMqPKblWHjVxZ98nIqqASbuDI8vJG3qcSLvSLKCBt8=; b=PIc4Gh8krjovCqRFHRYrkHQXp4nXHsiwHnA8yeXpuFarXlx4+eejfw/L1TTSl61JJ2W6GF4EfEQMuAgOUSxESOKSbtH4XGtj/I+DNH3nwbiou6xfdebc/FzzRJAZb0Orlp5INdEdJ5qNSHH3c2S4Fc9SUcB5c1SZKSSFTK45www= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590947975573336.4905051418913; Sun, 31 May 2020 10:59:35 -0700 (PDT) Received: from localhost ([::1]:57520 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSFC-000244-Bd for importer@patchew.org; Sun, 31 May 2020 13:59:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36530) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSAO-0003g9-6j; Sun, 31 May 2020 13:54:36 -0400 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:36076) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfSAN-0007dS-Ei; Sun, 31 May 2020 13:54:35 -0400 Received: by mail-wm1-x344.google.com with SMTP id d128so9187218wmc.1; Sun, 31 May 2020 10:54:34 -0700 (PDT) Received: from localhost.localdomain (43.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.43]) by smtp.gmail.com with ESMTPSA id z7sm17862531wrt.6.2020.05.31.10.54.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 10:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RUMqPKblWHjVxZ98nIqqASbuDI8vJG3qcSLvSLKCBt8=; b=X+8eI/C4OhMfctTsS73+OghNMtcX/UEvdJo2GwriLZwNzWr6kcvX7lAzZaBK/UOsLR QNV34xFe+hb1aFe1WxT+liWxk8XdVB+xkrJxHZ4V6Zpycz6bBCoOXmNIYc1ueiVCM7OV GAnFaLBS4kA8vdtTQyiTgn/EFiATZUbk0tce6OPAS7bPLAWBeVE8ZonfKKTZLDYYglHS +9ejhU+BBCnY6Gd1X/bK1LedC75UiWzR5CZ3dE7AaTFPGduYnaSI00iEnye7fSZZ/fsn mi1b2v2HsfdAWhoLO/lXNPq6xJ73BR5j3KRxu1B5ImPH4JoEsBUXLWq3PUBb9TrwX6+a 2t7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RUMqPKblWHjVxZ98nIqqASbuDI8vJG3qcSLvSLKCBt8=; b=NrXDrCavVU0PtPw00P+y32HnofRpoE5VyjCSwJOnmv8yDNN6hSwfQI8VkJKgGJxoHY 3eLBmFj4UvR4syzDNbo3SvPkkkuJaO3oOyl+cmBj8Fd2qtCJk0SuPqWaX8oX92wngWrH +sW5N/qk8COoShcl44DFG+MkGPcWetWXYnUzpJi3TubcbJ+3YQ5jVORz9ZYu5TLjS4Y+ x3eP3fqO+w5FLBKYHV7kPdCah7nrwQ9gjOYHkP0Wrn864OyFue2AiKUzYJ43tToPKWxB uRLdGd5p06FN9OPAy+wzE/jd4yAYdxdw4r9fHaf1KS48mKWUcXkyhd4IX8vVVUf7zs2I hixQ== X-Gm-Message-State: AOAM532TXkrvdyN59tiuEGrOHVIODvR9uIp0V8LBMcmE9dSx5lU72gA9 2xkjxUa0818As1iOWbd7mgRTzBwl X-Google-Smtp-Source: ABdhPJwCaiuZuI9J6B7vunUSeiqVjQhHpoq0Dhwc6Ep+Qgglfz6RGDoUPVR5vT5eCKikFH0pqMvm4w== X-Received: by 2002:a1c:96c3:: with SMTP id y186mr17785194wmd.60.1590947673231; Sun, 31 May 2020 10:54:33 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 4/6] exec/cpu-common: Do not restrict CPU to 32-bit memory access maximum Date: Sun, 31 May 2020 19:54:23 +0200 Message-Id: <20200531175425.10329-5-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200531175425.10329-1-f4bug@amsat.org> References: <20200531175425.10329-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::344; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x344.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , David Hildenbrand , Cornelia Huck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Beniamino Galvani , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Most CPUs can do 64-bit operations. Update the CPUReadMemoryFunc and CPUWriteMemoryFunc prototypes. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- include/exec/cpu-common.h | 4 ++-- hw/usb/hcd-musb.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index b47e5630e7..5ac766e3b6 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -43,8 +43,8 @@ extern ram_addr_t ram_size; =20 /* memory API */ =20 -typedef void CPUWriteMemoryFunc(void *opaque, hwaddr addr, uint32_t value); -typedef uint32_t CPUReadMemoryFunc(void *opaque, hwaddr addr); +typedef void CPUWriteMemoryFunc(void *opaque, hwaddr addr, uint64_t value); +typedef uint64_t CPUReadMemoryFunc(void *opaque, hwaddr addr); =20 void qemu_ram_remap(ram_addr_t addr, ram_addr_t length); /* This should not be used by devices. */ diff --git a/hw/usb/hcd-musb.c b/hw/usb/hcd-musb.c index c29fbef6fc..4063cbccf8 100644 --- a/hw/usb/hcd-musb.c +++ b/hw/usb/hcd-musb.c @@ -1243,7 +1243,7 @@ static void musb_ep_writeh(void *opaque, int ep, int = addr, uint16_t value) } =20 /* Generic control */ -static uint32_t musb_readb(void *opaque, hwaddr addr) +static uint64_t musb_readb(void *opaque, hwaddr addr) { MUSBState *s =3D (MUSBState *) opaque; int ep, i; @@ -1305,7 +1305,7 @@ static uint32_t musb_readb(void *opaque, hwaddr addr) }; } =20 -static void musb_writeb(void *opaque, hwaddr addr, uint32_t value) +static void musb_writeb(void *opaque, hwaddr addr, uint64_t value) { MUSBState *s =3D (MUSBState *) opaque; int ep; @@ -1392,7 +1392,7 @@ static void musb_writeb(void *opaque, hwaddr addr, ui= nt32_t value) }; } =20 -static uint32_t musb_readh(void *opaque, hwaddr addr) +static uint64_t musb_readh(void *opaque, hwaddr addr) { MUSBState *s =3D (MUSBState *) opaque; int ep, i; @@ -1446,7 +1446,7 @@ static uint32_t musb_readh(void *opaque, hwaddr addr) }; } =20 -static void musb_writeh(void *opaque, hwaddr addr, uint32_t value) +static void musb_writeh(void *opaque, hwaddr addr, uint64_t value) { MUSBState *s =3D (MUSBState *) opaque; int ep; @@ -1502,7 +1502,7 @@ static void musb_writeh(void *opaque, hwaddr addr, ui= nt32_t value) }; } =20 -static uint32_t musb_readw(void *opaque, hwaddr addr) +static uint64_t musb_readw(void *opaque, hwaddr addr) { MUSBState *s =3D (MUSBState *) opaque; int ep; @@ -1520,7 +1520,7 @@ static uint32_t musb_readw(void *opaque, hwaddr addr) }; } =20 -static void musb_writew(void *opaque, hwaddr addr, uint32_t value) +static void musb_writew(void *opaque, hwaddr addr, uint64_t value) { MUSBState *s =3D (MUSBState *) opaque; int ep; --=20 2.21.3 From nobody Fri May 17 02:41:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1590948065; cv=none; d=zohomail.com; s=zohoarc; b=LujsHj3W+0jmlBCH+o8+TpwaKZa/2UvAducdECyIGmTYVXBXHcsLiRzZf+AgiGqIRJ8qnkRGJPhKMC5gjeRkQzA9eKZk4cgSM0AxQrLn+w7vyrC/ZzAszj6Lxdf1dpp0vtmaaJVb48EXoK0MU9dCAcQxlXPeq9tohlgYJDobwak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590948065; h=Content-Type:Content-Transfer-Encoding:Cc: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=RxLw4QcKrYbunBKOIFiXjKfQ22xYQIVcbponl1x6BVE=; b=TAPKpIxFGs5i6mtfcvr3agfNB3nT8SG2LGnqx1yagGOqM1tzCfMROzDGZAT8ulk2EXcRtEH2ArqA4/zl/UehBDZQ8NVCBhIjjJtc7oOOlUJDneOzSbOQ8OBL1hFJgM54E9VSsZoZ86sACtX0tLVeLBu8cy4k2ZkZbLk0J/UFYuw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590948065467855.4861543872994; Sun, 31 May 2020 11:01:05 -0700 (PDT) Received: from localhost ([::1]:60722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSGe-0003TA-31 for importer@patchew.org; Sun, 31 May 2020 14:01:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36536) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSAP-0003jM-GT; Sun, 31 May 2020 13:54:37 -0400 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]:42388) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfSAO-0007fm-Lg; Sun, 31 May 2020 13:54:37 -0400 Received: by mail-wr1-x442.google.com with SMTP id p5so3278603wrw.9; Sun, 31 May 2020 10:54:35 -0700 (PDT) Received: from localhost.localdomain (43.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.43]) by smtp.gmail.com with ESMTPSA id z7sm17862531wrt.6.2020.05.31.10.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 10:54:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RxLw4QcKrYbunBKOIFiXjKfQ22xYQIVcbponl1x6BVE=; b=Khbp+GoBcISHb5ous2OLktoshnUtyXO/ouTWpf/PhYqSW0AtUiYvKIzqIdaug01Cxg fTpFIwHFS6evRAuvnZ27wTkYQnQ3Q0OqV8+FPc4ug494g4jC2Rp7mROG/cFWw6Kl3nCK kbUtdrZASaOx5EU7mVZObufiIVd2Wu+s7v4BKmUnP1Za1CGghP4qzeaeVMsPwIQUs154 d6L4QoK4LOKQFOxbhtlY0TLzcJOh3C8wNTlNvSRVK20adYtNnyUxdNqbYjmVO3cERhT0 NJ5Wx8DP6pcJXzfjRpowbkQUfV7hyoX2EdXSGOm3ACVpwDFLhrlhKTPRYSrohjIavf/l PPUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=RxLw4QcKrYbunBKOIFiXjKfQ22xYQIVcbponl1x6BVE=; b=VynKJoefzWUemcwXH3XPa8X+8Rt5hG2SAoczOlygBsa7oj5+eGm7ZOidMuHdxNS+kI QaYiHulTszcCvs4GKJSNehDwW5I7L7rps3GWCXJLtiEXSvPg/cu6adngSJe7sHyvJVU3 TCKCDDiKi5QM134UiHx0+h+XAL/vru56XsoSQ8Nbmpzu8DwAMxYn2dGySrjMYbNZ2Cs+ e+XFeRVlfcZmkCwrsVMwhsfNvCfz1zE3W2z2qSKlUApR6Ndk18VZqj/Q5aZmuRgIh9F8 R45IYRWh2Qum6qWB2uZ1Gg6IlCoCzEbrxa8Cugz0iqQGlNta/FeEgKgQ1FGVIg8uOzyt +ZEA== X-Gm-Message-State: AOAM532t/XupDdfQyOK1dwKe9vKjXdBalq31rxoDTwdkZlp8IcVdQ+og 7ZxL1oljziNhWua6OAlUFp6bhjAk X-Google-Smtp-Source: ABdhPJxl1aJq3cAYSE4P6/JdRm/0LgJ/b8rKZ5O2K5msI/CQp2WAN7YjBCpYwlMQJu79VOyByRsOFQ== X-Received: by 2002:adf:fe07:: with SMTP id n7mr10524769wrr.240.1590947674465; Sun, 31 May 2020 10:54:34 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 5/6] exec: Restrict 32-bit CPUs to 32-bit address space Date: Sun, 31 May 2020 19:54:24 +0200 Message-Id: <20200531175425.10329-6-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200531175425.10329-1-f4bug@amsat.org> References: <20200531175425.10329-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::442; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x442.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , David Hildenbrand , Cornelia Huck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Beniamino Galvani , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) It is pointless to have 32-bit CPUs see a 64-bit address space, when they can only address the 32 lower bits. Only create CPU address space with a size it can address. This makes HMP 'info mtree' command easier to understand (on 32-bit CPUs). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- This is particularly helpful with the AVR cores. --- exec.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/exec.c b/exec.c index 5162f0d12f..d6809a9447 100644 --- a/exec.c +++ b/exec.c @@ -2962,9 +2962,17 @@ static void tcg_commit(MemoryListener *listener) =20 static void memory_map_init(void) { + uint64_t system_memory_size; + +#if TARGET_LONG_BITS >=3D 64 + system_memory_size =3D UINT64_MAX; +#else + system_memory_size =3D 1ULL << TARGET_LONG_BITS; +#endif + system_memory =3D g_malloc(sizeof(*system_memory)); =20 - memory_region_init(system_memory, NULL, "system", UINT64_MAX); + memory_region_init(system_memory, NULL, "system", system_memory_size); address_space_init(&address_space_memory, system_memory, "memory"); =20 system_io =3D g_malloc(sizeof(*system_io)); --=20 2.21.3 From nobody Fri May 17 02:41:20 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1590947890; cv=none; d=zohomail.com; s=zohoarc; b=e2wSf7nwuf300MjPs/LjhwL/1P2E+m7oHbM0Z3b6pclwv8gzFiYd7eacOE0lg6HlY2nRoo/bREqJkQLZ4acAiLKuLH4Mw9WQacAXQqCoHzwDi4IZzqP2/HoXLRFm42l0eVNb+gUsu3yFsguJc4RSIsdJjnP+w0YdOUpkWon0KBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1590947890; h=Content-Type:Content-Transfer-Encoding:Cc: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=o8b6+X1LLYHejSweB/c4hEC47Dl6kTi087mc3N8TiLA=; b=Oej4Swct68mAEgJgyYQBfAbScWONOTPVTvRa3oljkDEDMDeQPaj/Q6uTFgs2jmkMEItRwC9WdKdkRjBt+yREv/TWvJ4mbyg1+qeR28+ZSThjBRdKznMbIO6NYiwK48VWj8uFN6eL8pgpXmt2+FZRKhIFipE6gaMsDe6uCnXySvw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1590947890880175.95727835172988; Sun, 31 May 2020 10:58:10 -0700 (PDT) Received: from localhost ([::1]:54056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jfSDp-0000Wl-Oj for importer@patchew.org; Sun, 31 May 2020 13:58:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jfSAQ-0003nX-RP; Sun, 31 May 2020 13:54:38 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54318) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jfSAP-0007gj-Tf; Sun, 31 May 2020 13:54:38 -0400 Received: by mail-wm1-x342.google.com with SMTP id g10so1003202wmh.4; Sun, 31 May 2020 10:54:36 -0700 (PDT) Received: from localhost.localdomain (43.red-83-51-162.dynamicip.rima-tde.net. [83.51.162.43]) by smtp.gmail.com with ESMTPSA id z7sm17862531wrt.6.2020.05.31.10.54.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 May 2020 10:54:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o8b6+X1LLYHejSweB/c4hEC47Dl6kTi087mc3N8TiLA=; b=ldCRS+zcerY/fL38TEcn9Q/4Q/0bc5RQ01rWlVEoyJuZZcK7/AEPS3jwvEfR88dPIy yGmY36bBRNcPQhwhu5rz7K6UQuJVi0+k42YRwMRofsKi42xDxawpqH0fxIsbTn3VxKSb ojCEt/l0qS+xgZFDl5L3/AV4sx5XmsTvY7A1jlXoiTP3bDh4+V0nm0xinG23YDGeK3M1 ckCvNNit8cPrs1IRIct+DRtIF7S8UQP/05bDBI4d5LeDyC4HOVS8isSkvz/hZamciIiO MI/hflFE3377syDgWbAHIYC8tdYuwWf11AbL1bKMQE3+KBCWKupkKJhWT3/4w+a/vxJj +s5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=o8b6+X1LLYHejSweB/c4hEC47Dl6kTi087mc3N8TiLA=; b=BieQXDhJ37r0eON0xyC0UMXMVNWHU+63/iS2J1SbZUT+zemlS6uO5FhdK4/M2/2Pwq QkUSI0kZPINBXTonWNdEcR7UNO2a3g+0VCuZwDzmBsQSf/qZepLQhx+jlZMYKRSUSU20 CEDY35B1or+1D/VEaC3ZpvKbhFgcNGN75os+9a8Zq08tNKVFqnuEcVW5/q8IqEoOa0VA 2Egpqc04UqYK54xTPbOUDWk6tictlp+lmL3X+e8az3GOCn7xwdpWpILv0MpFCv+RTXhn zqbDD6ar04Pt6yFOr1HfDAhZ+YLaTAraQZgRyiirsF8ZjOTF/fgDQ9OBbfVPfFU0iEOA a8Tw== X-Gm-Message-State: AOAM533u+tpLiMsaNwx04UafYX9PMlt61YDSbnWGlIqzIdYTHTe0n+Oy lxUl/CpiP584YFphou4QRsNbX3DK X-Google-Smtp-Source: ABdhPJyFXiBmYlgd9smjQLW518laiLxXT1vvTA3PiyU15lWvlXIgEa+2EZnAY3GF2/sJXehrqbTcYA== X-Received: by 2002:a7b:cb99:: with SMTP id m25mr17938496wmi.0.1590947675719; Sun, 31 May 2020 10:54:35 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [RFC PATCH 6/6] memory: Use CPU register size as default access_size_max Date: Sun, 31 May 2020 19:54:25 +0200 Message-Id: <20200531175425.10329-7-f4bug@amsat.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20200531175425.10329-1-f4bug@amsat.org> References: <20200531175425.10329-1-f4bug@amsat.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Aleksandar Rikalo , David Hildenbrand , Cornelia Huck , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Beniamino Galvani , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?UTF-8?q?Herv=C3=A9=20Poussineau?= , Gerd Hoffmann , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Do not restrict 64-bit CPU to 32-bit max access by default. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- RFC because this probably require an audit of all devices used on 64-bit targets. But if we find such problematic devices, they should instead enforce their access_size_max =3D 4 rather than expecting the default value to be valid... --- memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memory.c b/memory.c index fd6f3d6aca..1d6bb5cdb0 100644 --- a/memory.c +++ b/memory.c @@ -1370,7 +1370,7 @@ bool memory_region_access_valid(MemoryRegion *mr, =20 access_size_max =3D mr->ops->valid.max_access_size; if (!mr->ops->valid.max_access_size) { - access_size_max =3D 4; + access_size_max =3D TARGET_LONG_SIZE; } =20 access_size =3D MAX(MIN(size, access_size_max), access_size_min); --=20 2.21.3