From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394157; cv=none; d=zohomail.com; s=zohoarc; b=kXu+oRJ/pUncTeXCdfGmPAQ8Kilz1IN4ZqdnCyFlS86Zcd2WcE9NuDVUMbmj3K1aj0rLwmX6MKlsaR6iUgwcqGmiEC7/CDMKFC5G8LkWQKIjjlOoMODn2we/siQm5A33Lw9CBbYxHc1U3AEfoSkE+jK68aNV7iDkqWz4iUt4kUw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394157; 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=DfCX9xXcPSNiafrTCIlxD241Lt6uq38zwMtvTBs3n6A=; b=EWEdjZeM4qUOl1K265TmN3zlb8a4HyV0iKscvDT9gm3dOaSznaRtsqPQOdNGjFTl98Z09XP+S36tMyu30CM4oSaTj/Px1B8ieGtfpfk5UzJvrW42kb8tW9MJ4Z/I+Sk+qC9og2nBO7FfxwH6cptqmIC6AlyW3O9SxszJqQcQr5Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394157269573.5636574479795; Mon, 16 Mar 2020 14:29:17 -0700 (PDT) Received: from localhost ([::1]:49198 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIS-00047e-0H for importer@patchew.org; Mon, 16 Mar 2020 17:29:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41337) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxGw-0002HX-QS for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxGv-0008JK-Kb for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:42 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:24671) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxGv-00084b-FT for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-226-T9WO4QS-N-SInAq1uaFo6A-1; Mon, 16 Mar 2020 17:27:38 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B7B631804544 for ; Mon, 16 Mar 2020 21:27:35 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48EA419756; Mon, 16 Mar 2020 21:27:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DfCX9xXcPSNiafrTCIlxD241Lt6uq38zwMtvTBs3n6A=; b=LsocLmFpGIBjboCzaiAH48FU/nO/sIumjyvhFl/QHdrwKpUi7L3O/9dXt9Rw5MBa9fGWtH An8VviLuXxHT1qgBPzb+toqSBikLHzgMbm3hju3NUqyQZ8sHzBmUfL9svDpLkCV1ZArU+q 7rSDRRRBxh33lKD5N2AzakasIiowNzs= X-MC-Unique: T9WO4QS-N-SInAq1uaFo6A-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 01/61] scsi/qemu-pr-helper: Fix out-of-bounds access to trnptid_list[] Date: Mon, 16 Mar 2020 22:26:28 +0100 Message-Id: <1584394048-44994-2-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Christophe de Dinechin Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Christophe de Dinechin Compile error reported by gcc 10.0.1: scsi/qemu-pr-helper.c: In function =E2=80=98multipath_pr_out=E2=80=99: scsi/qemu-pr-helper.c:523:32: error: array subscript is outside a= rray bounds of =E2=80=98struct transportid *[0]=E2=80=99 [-Werror=3Darray-b= ounds] 523 | paramp.trnptid_list[paramp.num_transportid++] =3D id; | ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from scsi/qemu-pr-helper.c:36: /usr/include/mpath_persist.h:168:22: note: while referencing =E2=80=98trnpt= id_list=E2=80=99 168 | struct transportid *trnptid_list[]; | ^~~~~~~~~~~~ scsi/qemu-pr-helper.c:424:35: note: defined here =E2=80=98paramp=E2=80=99 424 | struct prout_param_descriptor paramp; | ^~~~~~ This highlights an actual implementation issue in function multipath_pr_out. The variable paramp is declared with type `struct prout_param_descriptor`, which is a struct terminated by an empty array in mpath_persist.h: struct transportid *trnptid_list[]; That empty array was filled with code that looked like that: trnptid_list[paramp.descr.num_transportid++] =3D id; This is an actual out-of-bounds access. The fix is to malloc `paramp`. Signed-off-by: Christophe de Dinechin Signed-off-by: Paolo Bonzini --- scsi/qemu-pr-helper.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 0659cee..181ed4a 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -421,10 +421,13 @@ static int multipath_pr_out(int fd, const uint8_t *cd= b, uint8_t *sense, int rq_servact =3D cdb[1]; int rq_scope =3D cdb[2] >> 4; int rq_type =3D cdb[2] & 0xf; - struct prout_param_descriptor paramp; + g_autofree struct prout_param_descriptor *paramp =3D NULL; char transportids[PR_HELPER_DATA_SIZE]; int r; =20 + paramp =3D g_malloc0(sizeof(struct prout_param_descriptor) + + sizeof(struct transportid *) * MPATH_MX_TIDS); + if (sz < PR_OUT_FIXED_PARAM_SIZE) { /* Illegal request, Parameter list length error. This isn't fatal; * we have read the data, send an error without closing the socket. @@ -454,10 +457,9 @@ static int multipath_pr_out(int fd, const uint8_t *cdb= , uint8_t *sense, * used by libmpathpersist (which, of course, will immediately * do the opposite). */ - memset(¶mp, 0, sizeof(paramp)); - memcpy(¶mp.key, ¶m[0], 8); - memcpy(¶mp.sa_key, ¶m[8], 8); - paramp.sa_flags =3D param[20]; + memcpy(¶mp->key, ¶m[0], 8); + memcpy(¶mp->sa_key, ¶m[8], 8); + paramp->sa_flags =3D param[20]; if (sz > PR_OUT_FIXED_PARAM_SIZE) { size_t transportid_len; int i, j; @@ -520,12 +522,13 @@ static int multipath_pr_out(int fd, const uint8_t *cd= b, uint8_t *sense, return CHECK_CONDITION; } =20 - paramp.trnptid_list[paramp.num_transportid++] =3D id; + assert(paramp->num_transportid < MPATH_MX_TIDS); + paramp->trnptid_list[paramp->num_transportid++] =3D id; } } =20 r =3D mpath_persistent_reserve_out(fd, rq_servact, rq_scope, rq_type, - ¶mp, noisy, verbose); + paramp, noisy, verbose); return mpath_reconstruct_sense(fd, r, sense); } #endif --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394156; cv=none; d=zohomail.com; s=zohoarc; b=HoeKJHGAXBhZ+5R9EpMP8gCWxlCEECEA6m7f8kRGsAgN0oETislOCmJFl0EoITm5fZMrqyuMivdv5fLfebCrmhs2R0cMJaSEp08mShG0NhLNzXHGwNj8voVIPSeUe0qca4xKIk/7beaf/4tTnATt1sNGdRo0hpC+kPe4KUjHzB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394156; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=SPff1aAq5h+xYYQS6oaEMbpCVwyAPpdhhSZnmMWHIeg=; b=cdFw8wUcHtQYxVGShV3hg/JdEKbGNMEt6KAVSRQYlE6ZSXTz23beh/W8TKPSs5AdPysy2b9BQvruFNOayuKnzR2GGwV2c06I13Qn9bfTY9JGqQVvfjAhyvAAWR+poJutm0rDbVpO961vUEkj5ztn8TzNHUE1jI8tT/43CmDspxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394156231438.96783246606674; Mon, 16 Mar 2020 14:29:16 -0700 (PDT) Received: from localhost ([::1]:49186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIQ-00042p-T1 for importer@patchew.org; Mon, 16 Mar 2020 17:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41324) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxGw-0002H5-Ef for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxGv-0008HN-CU for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:42 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:35477) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxGv-0008C5-7O for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:41 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-430-GxPavsXNPDuXSH_mo5eF-g-1; Mon, 16 Mar 2020 17:27:38 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EE34107ACC9; Mon, 16 Mar 2020 21:27:37 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2C9D819756; Mon, 16 Mar 2020 21:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394060; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SPff1aAq5h+xYYQS6oaEMbpCVwyAPpdhhSZnmMWHIeg=; b=DsYS+E1CJSa1GCi3c2xFaFk2xhV2TOHClVQYQuOVVaJF3Xs1SJCQUyIgD1fKOO16HSNxS8 y+kG0doUl48sGb9l6zPQEEQzU/KCFnMVMN7WaOw9h+LOyLZHR1qtTKP5ZzODIVGP0ROTgU gV3/AnH+9hIydm/G8rjsznyBfiCzbrg= X-MC-Unique: GxPavsXNPDuXSH_mo5eF-g-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 02/61] optionrom/pvh: scan entire RSDP Area Date: Mon, 16 Mar 2020 22:26:29 +0100 Message-Id: <1584394048-44994-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Joe Richey Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Joe Richey Right now the PVH option rom scans for the RSDP from 0xE0000 to 0xE1FFF. This is probobly a typo, it should scan from 0xE0000 to 0xFFFFF. This is actually an issue on some QEMU versions/machines. For example, when I run QEMU the RSDP is placed at 0xf5ad0 which will not be picked up by the current implementation. This bug still allows a Linux guest to boot (in most configurations) as the kernel will just scan for the RSDP if one isn't provided. Signed-off-by: Joe Richey Reviewed-by: Stefano Garzarella Fixes: 2785dc7b17 ("optionrom: add new PVH option rom") Signed-off-by: Paolo Bonzini --- pc-bios/optionrom/pvh_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pc-bios/optionrom/pvh_main.c b/pc-bios/optionrom/pvh_main.c index a015e1b..28e79d7 100644 --- a/pc-bios/optionrom/pvh_main.c +++ b/pc-bios/optionrom/pvh_main.c @@ -29,7 +29,7 @@ asm (".code32"); /* this code will be executed in protect= ed mode */ =20 #define RSDP_SIGNATURE 0x2052545020445352LL /* "RSD PTR " */ #define RSDP_AREA_ADDR 0x000E0000 -#define RSDP_AREA_SIZE 2048 +#define RSDP_AREA_SIZE 0x00020000 #define EBDA_BASE_ADDR 0x0000040E #define EBDA_SIZE 1024 =20 --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394517; cv=none; d=zohomail.com; s=zohoarc; b=YSDU6vb2A3Gkzo0nwB/QCrqFUbWHZDWq9de6MLWFj4bF2Zfjrl0pUC19Zhbtc2/RhQW83cKr6JKMmX2FZcTe1Gt1mQcWCKEWfdXIy+pT2M+R/GqFcFsJbAxAJ0rog9521QYC6yjiz+e0hnfllCy826XEJIhFiOtEhaqdev06Cyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394517; 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=dm/EuTkxE9RqTe8WAQAMKzeZ4YbmePbXoehbDlbCm2s=; b=FjU2+5WpjvnDjoPLgdHWCIw+jxIyJpaUXjrOKI0e0gyBG9GTeHb+aEcehWG2AqtZyn7dXQtUA3LJOwEju/iGM5Zsoibp1pzmE5SXSwkJg56X87HsudurUphvp1qvCKzUc3Q+e5Cn8Kc7rTPi2yZaG6fiBdt7ezhImcCGZt8Afsg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394517971120.84086193847611; Mon, 16 Mar 2020 14:35:17 -0700 (PDT) Received: from localhost ([::1]:49326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxOG-0002zz-MD for importer@patchew.org; Mon, 16 Mar 2020 17:35:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41470) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH2-0002T7-Er for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxGz-0000MW-Sn for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:48 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:32480) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxGz-0000Fl-Ls for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-331-BZV9f3uZO_SCSHHcizkwYw-1; Mon, 16 Mar 2020 17:27:39 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7BC41107ACC7 for ; Mon, 16 Mar 2020 21:27:38 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B33E19756; Mon, 16 Mar 2020 21:27:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dm/EuTkxE9RqTe8WAQAMKzeZ4YbmePbXoehbDlbCm2s=; b=VvSXoLGmY+KUnwYfpL5S3VRb6RZEVl8r5rMg7YyIXKeEnieqLP7NeRgFDdgfxGYAkLrIFe TEWVGd82Pro0+QJSEuzEnKlRKqe5s4oV7NIo+KCDpG/kBEwJTsuBXdF5P4fgR/AK8HKdYp wW2a1aNNBO8GEiBq27ZPc4s4vgMBHvU= X-MC-Unique: BZV9f3uZO_SCSHHcizkwYw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 03/61] misc: Replace zero-length arrays with flexible array member (automatic) Date: Mon, 16 Mar 2020 22:26:30 +0100 Message-Id: <1584394048-44994-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Description copied from Linux kernel commit from Gustavo A. R. Silva (see [3]): --v-- description start --v-- The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member [1], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being unadvertenly introduced [2] to the Linux codebase from now on. --^-- description end --^-- Do the similar housekeeping in the QEMU codebase (which uses C99 since commit 7be41675f7cb). All these instances of code were found with the help of the following Coccinelle script: @@ identifier s, m, a; type t, T; @@ struct s { ... t m; - T a[0]; + T a[]; }; @@ identifier s, m, a; type t, T; @@ struct s { ... t m; - T a[0]; + T a[]; } QEMU_PACKED; [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/comm= it/?id=3D76497732932f [3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/co= mmit/?id=3D17642a2fbd2c1 Inspired-by: Gustavo A. R. Silva Reviewed-by: David Hildenbrand Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- block/linux-aio.c | 2 +- bsd-user/qemu.h | 2 +- contrib/libvhost-user/libvhost-user.h | 2 +- hw/acpi/nvdimm.c | 6 +++--- hw/dma/soc_dma.c | 2 +- hw/i386/x86.c | 2 +- hw/m68k/bootinfo.h | 2 +- hw/misc/omap_l4.c | 2 +- hw/nvram/eeprom93xx.c | 2 +- hw/rdma/vmw/pvrdma_qp_ops.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/dev-smartcard-reader.c | 4 ++-- hw/virtio/virtio.c | 4 ++-- hw/xen/xen_pt.h | 2 +- include/hw/acpi/acpi-defs.h | 12 ++++++------ include/hw/arm/smmu-common.h | 2 +- include/hw/i386/intel_iommu.h | 3 ++- include/hw/virtio/virtio-iommu.h | 2 +- include/sysemu/cryptodev.h | 2 +- include/tcg/tcg.h | 2 +- net/queue.c | 2 +- pc-bios/s390-ccw/bootmap.h | 2 +- pc-bios/s390-ccw/sclp.h | 2 +- tests/qtest/libqos/ahci.h | 2 +- 24 files changed, 35 insertions(+), 34 deletions(-) diff --git a/block/linux-aio.c b/block/linux-aio.c index 91204a2..3c0527c 100644 --- a/block/linux-aio.c +++ b/block/linux-aio.c @@ -121,7 +121,7 @@ struct aio_ring { unsigned incompat_features; unsigned header_length; /* size of aio_ring */ =20 - struct io_event io_events[0]; + struct io_event io_events[]; }; =20 /** diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h index 09e8aed..f8bb1e5 100644 --- a/bsd-user/qemu.h +++ b/bsd-user/qemu.h @@ -95,7 +95,7 @@ typedef struct TaskState { struct sigqueue *first_free; /* first free siginfo queue entry */ int signal_pending; /* non zero if a signal may be pending */ =20 - uint8_t stack[0]; + uint8_t stack[]; } __attribute__((aligned(16))) TaskState; =20 void init_task_state(TaskState *ts); diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/= libvhost-user.h index 6fc8000..f30394f 100644 --- a/contrib/libvhost-user/libvhost-user.h +++ b/contrib/libvhost-user/libvhost-user.h @@ -286,7 +286,7 @@ typedef struct VuVirtqInflight { uint16_t used_idx; =20 /* Used to track the state of each descriptor in descriptor table */ - VuDescStateSplit desc[0]; + VuDescStateSplit desc[]; } VuVirtqInflight; =20 typedef struct VuVirtqInflightDesc { diff --git a/hw/acpi/nvdimm.c b/hw/acpi/nvdimm.c index 5219dd0..eb6a37b 100644 --- a/hw/acpi/nvdimm.c +++ b/hw/acpi/nvdimm.c @@ -485,7 +485,7 @@ struct NvdimmFuncGetLabelDataOut { /* the size of buffer filled by QEMU. */ uint32_t len; uint32_t func_ret_status; /* return status code. */ - uint8_t out_buf[0]; /* the data got via Get Namesapce Label function. = */ + uint8_t out_buf[]; /* the data got via Get Namesapce Label function. */ } QEMU_PACKED; typedef struct NvdimmFuncGetLabelDataOut NvdimmFuncGetLabelDataOut; QEMU_BUILD_BUG_ON(sizeof(NvdimmFuncGetLabelDataOut) > NVDIMM_DSM_MEMORY_SI= ZE); @@ -493,7 +493,7 @@ QEMU_BUILD_BUG_ON(sizeof(NvdimmFuncGetLabelDataOut) > N= VDIMM_DSM_MEMORY_SIZE); struct NvdimmFuncSetLabelDataIn { uint32_t offset; /* the offset in the namespace label data area. */ uint32_t length; /* the size of data is to be written via the function= . */ - uint8_t in_buf[0]; /* the data written to label data area. */ + uint8_t in_buf[]; /* the data written to label data area. */ } QEMU_PACKED; typedef struct NvdimmFuncSetLabelDataIn NvdimmFuncSetLabelDataIn; QEMU_BUILD_BUG_ON(sizeof(NvdimmFuncSetLabelDataIn) + @@ -510,7 +510,7 @@ struct NvdimmFuncReadFITOut { /* the size of buffer filled by QEMU. */ uint32_t len; uint32_t func_ret_status; /* return status code. */ - uint8_t fit[0]; /* the FIT data. */ + uint8_t fit[]; /* the FIT data. */ } QEMU_PACKED; typedef struct NvdimmFuncReadFITOut NvdimmFuncReadFITOut; QEMU_BUILD_BUG_ON(sizeof(NvdimmFuncReadFITOut) > NVDIMM_DSM_MEMORY_SIZE); diff --git a/hw/dma/soc_dma.c b/hw/dma/soc_dma.c index c3e4158..3a43005 100644 --- a/hw/dma/soc_dma.c +++ b/hw/dma/soc_dma.c @@ -80,7 +80,7 @@ struct dma_s { } *memmap; int memmap_size; =20 - struct soc_dma_ch_s ch[0]; + struct soc_dma_ch_s ch[]; }; =20 static void soc_dma_ch_schedule(struct soc_dma_ch_s *ch, int delay_bytes) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index 7f38e6b..0824652 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -328,7 +328,7 @@ struct setup_data { uint64_t next; uint32_t type; uint32_t len; - uint8_t data[0]; + uint8_t data[]; } __attribute__((packed)); =20 =20 diff --git a/hw/m68k/bootinfo.h b/hw/m68k/bootinfo.h index 5f8ded2..c954270 100644 --- a/hw/m68k/bootinfo.h +++ b/hw/m68k/bootinfo.h @@ -14,7 +14,7 @@ struct bi_record { uint16_t tag; /* tag ID */ uint16_t size; /* size of record */ - uint32_t data[0]; /* data */ + uint32_t data[]; /* data */ }; =20 /* machine independent tags */ diff --git a/hw/misc/omap_l4.c b/hw/misc/omap_l4.c index 61b6df5..54aeaec 100644 --- a/hw/misc/omap_l4.c +++ b/hw/misc/omap_l4.c @@ -24,7 +24,7 @@ struct omap_l4_s { MemoryRegion *address_space; hwaddr base; int ta_num; - struct omap_target_agent_s ta[0]; + struct omap_target_agent_s ta[]; }; =20 struct omap_l4_s *omap_l4_init(MemoryRegion *address_space, diff --git a/hw/nvram/eeprom93xx.c b/hw/nvram/eeprom93xx.c index 07f0954..ca6f591 100644 --- a/hw/nvram/eeprom93xx.c +++ b/hw/nvram/eeprom93xx.c @@ -86,7 +86,7 @@ struct _eeprom_t { uint8_t addrbits; uint16_t size; uint16_t data; - uint16_t contents[0]; + uint16_t contents[]; }; =20 /* Code for saving and restoring of EEPROM state. */ diff --git a/hw/rdma/vmw/pvrdma_qp_ops.c b/hw/rdma/vmw/pvrdma_qp_ops.c index bd6db85..8050287 100644 --- a/hw/rdma/vmw/pvrdma_qp_ops.c +++ b/hw/rdma/vmw/pvrdma_qp_ops.c @@ -34,13 +34,13 @@ typedef struct CompHandlerCtx { /* Send Queue WQE */ typedef struct PvrdmaSqWqe { struct pvrdma_sq_wqe_hdr hdr; - struct pvrdma_sge sge[0]; + struct pvrdma_sge sge[]; } PvrdmaSqWqe; =20 /* Recv Queue WQE */ typedef struct PvrdmaRqWqe { struct pvrdma_rq_wqe_hdr hdr; - struct pvrdma_sge sge[0]; + struct pvrdma_sge sge[]; } PvrdmaRqWqe; =20 /* diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 9a78ad9..6210427 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -626,7 +626,7 @@ static const uint32_t oid_supported_list[] =3D struct rndis_response { QTAILQ_ENTRY(rndis_response) entries; uint32_t length; - uint8_t buf[0]; + uint8_t buf[]; }; =20 typedef struct USBNetState { diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c index 02693a2..ef72738 100644 --- a/hw/usb/dev-smartcard-reader.c +++ b/hw/usb/dev-smartcard-reader.c @@ -227,7 +227,7 @@ typedef struct QEMU_PACKED CCID_Parameter { typedef struct QEMU_PACKED CCID_DataBlock { CCID_BULK_IN b; uint8_t bChainParameter; - uint8_t abData[0]; + uint8_t abData[]; } CCID_DataBlock; =20 /* 6.1.4 PC_to_RDR_XfrBlock */ @@ -235,7 +235,7 @@ typedef struct QEMU_PACKED CCID_XferBlock { CCID_Header hdr; uint8_t bBWI; /* Block Waiting Timeout */ uint16_t wLevelParameter; /* XXX currently unused */ - uint8_t abData[0]; + uint8_t abData[]; } CCID_XferBlock; =20 typedef struct QEMU_PACKED CCID_IccPowerOn { diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index b2d415e..b6c8ef5 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -54,7 +54,7 @@ typedef struct VRingAvail { uint16_t flags; uint16_t idx; - uint16_t ring[0]; + uint16_t ring[]; } VRingAvail; =20 typedef struct VRingUsedElem @@ -67,7 +67,7 @@ typedef struct VRingUsed { uint16_t flags; uint16_t idx; - VRingUsedElem ring[0]; + VRingUsedElem ring[]; } VRingUsed; =20 typedef struct VRingMemoryRegionCaches { diff --git a/hw/xen/xen_pt.h b/hw/xen/xen_pt.h index 9167bba..179775d 100644 --- a/hw/xen/xen_pt.h +++ b/hw/xen/xen_pt.h @@ -203,7 +203,7 @@ typedef struct XenPTMSIX { uint64_t mmio_base_addr; MemoryRegion mmio; void *phys_iomem_base; - XenPTMSIXEntry msix_entry[0]; + XenPTMSIXEntry msix_entry[]; } XenPTMSIX; =20 struct XenPCIPassthroughState { diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 57a3f58..19f7ba7 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -518,7 +518,7 @@ struct AcpiDmarDeviceScope { struct { uint8_t device; uint8_t function; - } path[0]; + } path[]; } QEMU_PACKED; typedef struct AcpiDmarDeviceScope AcpiDmarDeviceScope; =20 @@ -530,7 +530,7 @@ struct AcpiDmarHardwareUnit { uint8_t reserved; uint16_t pci_segment; /* The PCI Segment associated with this unit */ uint64_t address; /* Base address of remapping hardware register-set= */ - AcpiDmarDeviceScope scope[0]; + AcpiDmarDeviceScope scope[]; } QEMU_PACKED; typedef struct AcpiDmarHardwareUnit AcpiDmarHardwareUnit; =20 @@ -541,7 +541,7 @@ struct AcpiDmarRootPortATS { uint8_t flags; uint8_t reserved; uint16_t pci_segment; - AcpiDmarDeviceScope scope[0]; + AcpiDmarDeviceScope scope[]; } QEMU_PACKED; typedef struct AcpiDmarRootPortATS AcpiDmarRootPortATS; =20 @@ -604,7 +604,7 @@ typedef struct AcpiIortMemoryAccess AcpiIortMemoryAcces= s; struct AcpiIortItsGroup { ACPI_IORT_NODE_HEADER_DEF uint32_t its_count; - uint32_t identifiers[0]; + uint32_t identifiers[]; } QEMU_PACKED; typedef struct AcpiIortItsGroup AcpiIortItsGroup; =20 @@ -621,7 +621,7 @@ struct AcpiIortSmmu3 { uint32_t pri_gsiv; uint32_t gerr_gsiv; uint32_t sync_gsiv; - AcpiIortIdMapping id_mapping_array[0]; + AcpiIortIdMapping id_mapping_array[]; } QEMU_PACKED; typedef struct AcpiIortSmmu3 AcpiIortSmmu3; =20 @@ -630,7 +630,7 @@ struct AcpiIortRC { AcpiIortMemoryAccess memory_properties; uint32_t ats_attribute; uint32_t pci_segment_number; - AcpiIortIdMapping id_mapping_array[0]; + AcpiIortIdMapping id_mapping_array[]; } QEMU_PACKED; typedef struct AcpiIortRC AcpiIortRC; =20 diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h index 1f37844..ca4a4b1 100644 --- a/include/hw/arm/smmu-common.h +++ b/include/hw/arm/smmu-common.h @@ -85,7 +85,7 @@ typedef struct SMMUDevice { =20 typedef struct SMMUPciBus { PCIBus *bus; - SMMUDevice *pbdev[0]; /* Parent array is sparse, so dynamically allo= c */ + SMMUDevice *pbdev[]; /* Parent array is sparse, so dynamically alloc= */ } SMMUPciBus; =20 typedef struct SMMUIOTLBKey { diff --git a/include/hw/i386/intel_iommu.h b/include/hw/i386/intel_iommu.h index a1c4afc..3870052 100644 --- a/include/hw/i386/intel_iommu.h +++ b/include/hw/i386/intel_iommu.h @@ -114,7 +114,8 @@ struct VTDAddressSpace { =20 struct VTDBus { PCIBus* bus; /* A reference to the bus to provide translation for */ - VTDAddressSpace *dev_as[0]; /* A table of VTDAddressSpace objects inde= xed by devfn */ + /* A table of VTDAddressSpace objects indexed by devfn */ + VTDAddressSpace *dev_as[]; }; =20 struct VTDIOTLBEntry { diff --git a/include/hw/virtio/virtio-iommu.h b/include/hw/virtio/virtio-io= mmu.h index 6f67f10..e653004 100644 --- a/include/hw/virtio/virtio-iommu.h +++ b/include/hw/virtio/virtio-iommu.h @@ -41,7 +41,7 @@ typedef struct IOMMUDevice { =20 typedef struct IOMMUPciBus { PCIBus *bus; - IOMMUDevice *pbdev[0]; /* Parent array is sparse, so dynamically allo= c */ + IOMMUDevice *pbdev[]; /* Parent array is sparse, so dynamically alloc= */ } IOMMUPciBus; =20 typedef struct VirtIOIOMMU { diff --git a/include/sysemu/cryptodev.h b/include/sysemu/cryptodev.h index a9afb7e..35eab06 100644 --- a/include/sysemu/cryptodev.h +++ b/include/sysemu/cryptodev.h @@ -143,7 +143,7 @@ typedef struct CryptoDevBackendSymOpInfo { uint8_t *dst; uint8_t *aad_data; uint8_t *digest_result; - uint8_t data[0]; + uint8_t data[]; } CryptoDevBackendSymOpInfo; =20 typedef struct CryptoDevBackendClass { diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h index 54e5446..c48bd76 100644 --- a/include/tcg/tcg.h +++ b/include/tcg/tcg.h @@ -267,7 +267,7 @@ struct TCGLabel { typedef struct TCGPool { struct TCGPool *next; int size; - uint8_t data[0] __attribute__ ((aligned)); + uint8_t data[] __attribute__ ((aligned)); } TCGPool; =20 #define TCG_POOL_CHUNK_SIZE 32768 diff --git a/net/queue.c b/net/queue.c index 61276ca..0164727 100644 --- a/net/queue.c +++ b/net/queue.c @@ -46,7 +46,7 @@ struct NetPacket { unsigned flags; int size; NetPacketSent *sent_cb; - uint8_t data[0]; + uint8_t data[]; }; =20 struct NetQueue { diff --git a/pc-bios/s390-ccw/bootmap.h b/pc-bios/s390-ccw/bootmap.h index 94f53a5..12a0166 100644 --- a/pc-bios/s390-ccw/bootmap.h +++ b/pc-bios/s390-ccw/bootmap.h @@ -136,7 +136,7 @@ typedef struct BootMapScriptHeader { =20 typedef struct BootMapScript { BootMapScriptHeader header; - BootMapScriptEntry entry[0]; + BootMapScriptEntry entry[]; } __attribute__ ((packed)) BootMapScript; =20 /* diff --git a/pc-bios/s390-ccw/sclp.h b/pc-bios/s390-ccw/sclp.h index 8450161..64b53ca 100644 --- a/pc-bios/s390-ccw/sclp.h +++ b/pc-bios/s390-ccw/sclp.h @@ -95,7 +95,7 @@ typedef struct EventBufferHeader { typedef struct WriteEventData { SCCBHeader h; EventBufferHeader ebh; - char data[0]; + char data[]; } __attribute__((packed)) WriteEventData; =20 typedef struct ReadEventData { diff --git a/tests/qtest/libqos/ahci.h b/tests/qtest/libqos/ahci.h index f05b3e5..44ab110 100644 --- a/tests/qtest/libqos/ahci.h +++ b/tests/qtest/libqos/ahci.h @@ -351,7 +351,7 @@ typedef struct AHCIQState { typedef struct FIS { uint8_t fis_type; uint8_t flags; - char data[0]; + char data[]; } __attribute__((__packed__)) FIS; =20 /** --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394354; cv=none; d=zohomail.com; s=zohoarc; b=BNrWtp448djxuPqJYZLyeFAiwVgA2KXDsSx3ENvTlEW6xV0i2lfIe5xM+pqIHC3TrkH5aPRhOFZDpnu4tFTxDF8+OGshyvL6RCz4W5V5or4Xyv8cVXmcrnmE7ZP+aUHRkmTMpucMI7IEoAEoaxGdD9Ivx37YnyAhflSNp30RmWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394354; 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=R6e+v+OManYXqofQhTvrc5JkW78lq45Eovz+D7iEwTw=; b=X+DqPTYBEwXXD3IB7FWaWlu6LqMm8ZRCeDOwnt0Im42xi9PIebPA3UrSDZVHTh7y9aRdvaYiD41BAS2WeduADMLg9tpjpLP2Oqbd6PcijTj9oKzpzbHwJAbDYW5C8HCDpbSTnrxm9D/b2RBoV9UUuXCXOu87f2Riw6fgyNSgkcY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394354711908.0600357209703; Mon, 16 Mar 2020 14:32:34 -0700 (PDT) Received: from localhost ([::1]:49294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxLd-00080Z-Kw for importer@patchew.org; Mon, 16 Mar 2020 17:32:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41446) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH1-0002RZ-Ls for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxGz-0000KI-L1 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:47 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:35653) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxGz-0000HK-Ed for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-471-Jmgh-_2sNYiq0Giz2aVmzQ-1; Mon, 16 Mar 2020 17:27:41 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3359149C0 for ; Mon, 16 Mar 2020 21:27:39 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEA5519488; Mon, 16 Mar 2020 21:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394064; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R6e+v+OManYXqofQhTvrc5JkW78lq45Eovz+D7iEwTw=; b=IpcSv0JReTuIuakAcADL/UroQBfmiY563rT5EsPQVhNxxf4JxEuALne8627ZHo7anAXh+h wnMvcEQvw3hW1g+JnexsltJxlNpXsktHhY8flrnJlKy23dW3AAeqgahi26QPOOlDJ3SVio deKWOiEt990ANQjXYANBYKtYZaelZ28= X-MC-Unique: Jmgh-_2sNYiq0Giz2aVmzQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 04/61] misc: Replace zero-length arrays with flexible array member (manual) Date: Mon, 16 Mar 2020 22:26:31 +0100 Message-Id: <1584394048-44994-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Description copied from Linux kernel commit from Gustavo A. R. Silva (see [3]): --v-- description start --v-- The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member [1], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being unadvertenly introduced [2] to the Linux codebase from now on. --^-- description end --^-- Do the similar housekeeping in the QEMU codebase (which uses C99 since commit 7be41675f7cb). All these instances of code were found with the help of the following command (then manual analysis, without modifying structures only having a single flexible array member, such QEDTable in block/qed.h): git grep -F '[0];' [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/comm= it/?id=3D76497732932f [3] https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/co= mmit/?id=3D17642a2fbd2c1 Inspired-by: Gustavo A. R. Silva Reviewed-by: David Hildenbrand Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- block/vmdk.c | 2 +- docs/interop/vhost-user.rst | 4 ++-- hw/char/sclpconsole-lm.c | 2 +- hw/char/sclpconsole.c | 2 +- hw/s390x/virtio-ccw.c | 2 +- include/hw/acpi/acpi-defs.h | 4 ++-- include/hw/boards.h | 2 +- include/hw/s390x/event-facility.h | 2 +- include/hw/s390x/sclp.h | 8 ++++---- target/s390x/ioinst.c | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/block/vmdk.c b/block/vmdk.c index 20e909d..8466051 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -187,7 +187,7 @@ typedef struct VmdkMetaData { typedef struct VmdkGrainMarker { uint64_t lba; uint32_t size; - uint8_t data[0]; + uint8_t data[]; } QEMU_PACKED VmdkGrainMarker; =20 enum { diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 4016523..3b1b660 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -568,7 +568,7 @@ For split virtqueue, queue region can be implemented as: uint16_t used_idx; =20 /* Used to track the state of each descriptor in descriptor table */ - DescStateSplit desc[0]; + DescStateSplit desc[]; } QueueRegionSplit; =20 To track inflight I/O, the queue region should be processed as follows: @@ -690,7 +690,7 @@ For packed virtqueue, queue region can be implemented a= s: uint8_t padding[7]; =20 /* Used to track the state of each descriptor fetched from descripto= r ring */ - DescStatePacked desc[0]; + DescStatePacked desc[]; } QueueRegionPacked; =20 To track inflight I/O, the queue region should be processed as follows: diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index c420dc0..2b5f37b 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -31,7 +31,7 @@ typedef struct OprtnsCommand { EventBufferHeader header; MDMSU message_unit; - char data[0]; + char data[]; } QEMU_PACKED OprtnsCommand; =20 /* max size for line-mode data in 4K SCCB page */ diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index 1fa124d..5c76649 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -25,7 +25,7 @@ =20 typedef struct ASCIIConsoleData { EventBufferHeader ebh; - char data[0]; + char data[]; } QEMU_PACKED ASCIIConsoleData; =20 /* max size for ASCII data in 4K SCCB page */ diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 50cf95b..64f928f 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -193,7 +193,7 @@ typedef struct VirtioThinintInfo { typedef struct VirtioRevInfo { uint16_t revision; uint16_t length; - uint8_t data[0]; + uint8_t data[]; } QEMU_PACKED VirtioRevInfo; =20 /* Specify where the virtqueues for the subchannel are in guest memory. */ diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 19f7ba7..c13327f 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -152,7 +152,7 @@ typedef struct AcpiSerialPortConsoleRedirection */ struct AcpiRsdtDescriptorRev1 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - uint32_t table_offset_entry[0]; /* Array of pointers to other */ + uint32_t table_offset_entry[]; /* Array of pointers to other */ /* ACPI tables */ } QEMU_PACKED; typedef struct AcpiRsdtDescriptorRev1 AcpiRsdtDescriptorRev1; @@ -162,7 +162,7 @@ typedef struct AcpiRsdtDescriptorRev1 AcpiRsdtDescripto= rRev1; */ struct AcpiXsdtDescriptorRev2 { ACPI_TABLE_HEADER_DEF /* ACPI common table header */ - uint64_t table_offset_entry[0]; /* Array of pointers to other */ + uint64_t table_offset_entry[]; /* Array of pointers to other */ /* ACPI tables */ } QEMU_PACKED; typedef struct AcpiXsdtDescriptorRev2 AcpiXsdtDescriptorRev2; diff --git a/include/hw/boards.h b/include/hw/boards.h index 9bc42df..c96120d 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -71,7 +71,7 @@ typedef struct CPUArchId { */ typedef struct { int len; - CPUArchId cpus[0]; + CPUArchId cpus[]; } CPUArchIdList; =20 /** diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-fac= ility.h index bdc32a3..700a610 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -122,7 +122,7 @@ typedef struct MDBO { =20 typedef struct MDB { MdbHeader header; - MDBO mdbo[0]; + MDBO mdbo[]; } QEMU_PACKED MDB; =20 typedef struct SclpMsg { diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index c54413b..cd7b243 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -132,7 +132,7 @@ typedef struct ReadInfo { uint16_t highest_cpu; uint8_t _reserved5[124 - 122]; /* 122-123 */ uint32_t hmfai; - struct CPUEntry entries[0]; + struct CPUEntry entries[]; } QEMU_PACKED ReadInfo; =20 typedef struct ReadCpuInfo { @@ -142,7 +142,7 @@ typedef struct ReadCpuInfo { uint16_t nr_standby; /* 12-13 */ uint16_t offset_standby; /* 14-15 */ uint8_t reserved0[24-16]; /* 16-23 */ - struct CPUEntry entries[0]; + struct CPUEntry entries[]; } QEMU_PACKED ReadCpuInfo; =20 typedef struct ReadStorageElementInfo { @@ -151,7 +151,7 @@ typedef struct ReadStorageElementInfo { uint16_t assigned; uint16_t standby; uint8_t _reserved0[16 - 14]; /* 14-15 */ - uint32_t entries[0]; + uint32_t entries[]; } QEMU_PACKED ReadStorageElementInfo; =20 typedef struct AttachStorageElement { @@ -159,7 +159,7 @@ typedef struct AttachStorageElement { uint8_t _reserved0[10 - 8]; /* 8-9 */ uint16_t assigned; uint8_t _reserved1[16 - 12]; /* 12-15 */ - uint32_t entries[0]; + uint32_t entries[]; } QEMU_PACKED AttachStorageElement; =20 typedef struct AssignStorage { diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c index c437a1d..0e840cc 100644 --- a/target/s390x/ioinst.c +++ b/target/s390x/ioinst.c @@ -347,7 +347,7 @@ typedef struct ChscResp { uint16_t len; uint16_t code; uint32_t param; - char data[0]; + char data[]; } QEMU_PACKED ChscResp; =20 #define CHSC_MIN_RESP_LEN 0x0008 --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394354; cv=none; d=zohomail.com; s=zohoarc; b=M7hKBNJ6rVjrX4whHTN+9pP0UpKe9W5bu4Y1EmU+Ccaw9f/cFr8wqBbIQ4Nsio/20RkCtVTokfA2UiIDVrVF0UMP79ozjV2mtxFpVNvvCOdgDzkYY0D+dZDIf3gr1kcT8L+VDNcGmzb3aKeCpY0h3zo1Ep++qVudpEDRO6i6GpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394354; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=3uCy/at11WUsP92Tsm1LcEPN7d0Z7sh7F8Nakmm3N20=; b=nSAIiXy9uRG4n+oOkivcYaGU2ydnMBTzWhUwVrfD7MgJLsDUIE01O43nWVyhsgtE2GsGDfcxyW2P5ddeRXC8LfAYMETUkC2+Xm84eAblJOD4mmCZR97tZUqu9pg04aaaE2vjumKYa0cmQU3kWcPE6yAybqjGY+8/9708eyc9rMc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394354989518.2306142851303; Mon, 16 Mar 2020 14:32:34 -0700 (PDT) Received: from localhost ([::1]:49296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxLd-00083S-UY for importer@patchew.org; Mon, 16 Mar 2020 17:32:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41510) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH3-0002Vx-Ou for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxH1-0000fV-Pg for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:49 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:39267) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxH1-0000Yt-J8 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-222-rvGdDK7PPGWGZZiRfxRNXg-1; Mon, 16 Mar 2020 17:27:42 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3B2D2107ACC7; Mon, 16 Mar 2020 21:27:41 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47D8819756; Mon, 16 Mar 2020 21:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3uCy/at11WUsP92Tsm1LcEPN7d0Z7sh7F8Nakmm3N20=; b=BnZlOlAWg2pW4929MCu+hCD6vi+AMkbfwg3JUVsB0mmCEA2Ao4btogh82sf9GMPW7utFSR +0/GNjCqSx8wrCviXaUmRtNz75qabmIRwZzfFACgbjMKWw1ySTZmJAfZX3gPfPSjabDeRa Ihng9OaiJM94DuL054iPHbsNSQty67M= X-MC-Unique: rvGdDK7PPGWGZZiRfxRNXg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 05/61] configure: add configure option avx512f_opt Date: Mon, 16 Mar 2020 22:26:32 +0100 Message-Id: <1584394048-44994-6-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Robert Hoo Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Robert Hoo If it is enabled, config-host.mak will have CONFIG_AVX512F_OPT defined. AVX512F instruction set is available since Intel Skylake, and can be enable= d in compiling with -mavx512f. More info: https://software.intel.com/sites/default/files/managed/c5/15/architecture-i= nstruction-set-extensions-programming-reference.pdf Signed-off-by: Robert Hoo Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- configure | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/configure b/configure index eb49bb6..1a82683 100755 --- a/configure +++ b/configure @@ -1421,6 +1421,11 @@ for opt do ;; --enable-avx2) avx2_opt=3D"yes" ;; + --disable-avx512f) avx512f_opt=3D"no" + ;; + --enable-avx512f) avx512f_opt=3D"yes" + ;; + --enable-glusterfs) glusterfs=3D"yes" ;; --disable-virtio-blk-data-plane|--enable-virtio-blk-data-plane) @@ -1857,6 +1862,7 @@ disabled with --disable-FEATURE, default is enabled i= f available: tcmalloc tcmalloc support jemalloc jemalloc support avx2 AVX2 optimization support + avx512f AVX512F optimization support replication replication support opengl opengl support virglrenderer virgl rendering support @@ -5574,6 +5580,36 @@ EOF fi fi =20 +########################################## +# avx512f optimization requirement check +# +# There is no point enabling this if cpuid.h is not usable, +# since we won't be able to select the new routines. +# by default, it is turned off. +# if user explicitly want to enable it, check environment + +if test "$cpuid_h" =3D "yes" && test "$avx512f_opt" =3D "yes"; then + cat > $TMPC << EOF +#pragma GCC push_options +#pragma GCC target("avx512f") +#include +#include +static int bar(void *a) { + __m512i x =3D *(__m512i *)a; + return _mm512_test_epi64_mask(x, x); +} +int main(int argc, char *argv[]) +{ + return bar(argv[0]); +} +EOF + if ! compile_object "" ; then + avx512f_opt=3D"no" + fi +else + avx512f_opt=3D"no" +fi + ######################################## # check if __[u]int128_t is usable. =20 @@ -6717,6 +6753,7 @@ echo "libxml2 $libxml2" echo "tcmalloc support $tcmalloc" echo "jemalloc support $jemalloc" echo "avx2 optimization $avx2_opt" +echo "avx512f optimization $avx512f_opt" echo "replication support $replication" echo "VxHS block device $vxhs" echo "bochs support $bochs" @@ -7268,6 +7305,10 @@ if test "$avx2_opt" =3D "yes" ; then echo "CONFIG_AVX2_OPT=3Dy" >> $config_host_mak fi =20 +if test "$avx512f_opt" =3D "yes" ; then + echo "CONFIG_AVX512F_OPT=3Dy" >> $config_host_mak +fi + if test "$lzo" =3D "yes" ; then echo "CONFIG_LZO=3Dy" >> $config_host_mak fi --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394520; cv=none; d=zohomail.com; s=zohoarc; b=d/iY4mJjS3giKbigHuvp/sndH3ORxTGkyiWpO2XkzfQ7djp7/ORzR5RbTFY2DiHGL/DR23hVTJHGJq9xrw8e0rW8OVnU4w+SZcgpFLO0xRkdbhX4kJnuHGF9MpxjzMyOPiQdVYmjN3VjeSzixkOWzxJjyD3LlL44U29TiCQ+AwA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394520; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=yKYvUhjSJklIbG3VyhaS4xUOvCy4nVZady6qtVInulQ=; b=nxZBS1fxNquPb2E2p4S1IflOR1nj8iFzr7Ai994TkHLCwzVE6qp1SORrP9zCM13LkK8iJdou0oGSvtDkv8cmzSl0PT68ps4j18UrXC4vcLp9/l66JPovZY5C0uzfcyml9G1+QyS7G6vxFdLUq1GobjXwx753KchvbZrjXvIgC/M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394520531884.0424205388439; Mon, 16 Mar 2020 14:35:20 -0700 (PDT) Received: from localhost ([::1]:49328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxOJ-00034z-EU for importer@patchew.org; Mon, 16 Mar 2020 17:35:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41525) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH4-0002Wu-7A for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxH2-0000lE-ED for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:50 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:50817) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxH2-0000iK-7u for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-UvtGVBEfMRK_wlCmBZhjAA-1; Mon, 16 Mar 2020 17:27:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 979AC107ACCD; Mon, 16 Mar 2020 21:27:42 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A463919C4F; Mon, 16 Mar 2020 21:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yKYvUhjSJklIbG3VyhaS4xUOvCy4nVZady6qtVInulQ=; b=Owy3iBlO3Rux+GmDdAsoFbrpYDooyEodlZ3KZI74j+lzTMiXeU8Da596hafWOTza1JOqGs U3/X+hjmIfzcleB4IKyQS5Zm+Mg71uZRbZXNKByRN/1tCmNt2L2biycOjBe2toM4cweMlC Yh4runk49y1X/oD31M/kALDVofUVg+0= X-MC-Unique: UvtGVBEfMRK_wlCmBZhjAA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 06/61] util: add util function buffer_zero_avx512() Date: Mon, 16 Mar 2020 22:26:33 +0100 Message-Id: <1584394048-44994-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Robert Hoo Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Robert Hoo And intialize buffer_is_zero() with it, when Intel AVX512F is available on host. This function utilizes Intel AVX512 fundamental instructions which is faster than its implementation with AVX2 (in my unit test, with 4K buffer, on CascadeLake SP, ~36% faster, buffer_zero_avx512() V.S. buffer_zero_avx2()). Signed-off-by: Robert Hoo Reviewed-by: Richard Henderson Signed-off-by: Paolo Bonzini --- include/qemu/cpuid.h | 3 +++ util/bufferiszero.c | 74 +++++++++++++++++++++++++++++++++++++++++++++---= ---- 2 files changed, 67 insertions(+), 10 deletions(-) diff --git a/include/qemu/cpuid.h b/include/qemu/cpuid.h index 6930170..09fc245 100644 --- a/include/qemu/cpuid.h +++ b/include/qemu/cpuid.h @@ -45,6 +45,9 @@ #ifndef bit_AVX2 #define bit_AVX2 (1 << 5) #endif +#ifndef bit_AVX512F +#define bit_AVX512F (1 << 16) +#endif #ifndef bit_BMI2 #define bit_BMI2 (1 << 8) #endif diff --git a/util/bufferiszero.c b/util/bufferiszero.c index bfb2605..b6eab0c 100644 --- a/util/bufferiszero.c +++ b/util/bufferiszero.c @@ -63,11 +63,11 @@ buffer_zero_int(const void *buf, size_t len) } } =20 -#if defined(CONFIG_AVX2_OPT) || defined(__SSE2__) +#if defined(CONFIG_AVX512F_OPT) || defined(CONFIG_AVX2_OPT) || defined(__S= SE2__) /* Do not use push_options pragmas unnecessarily, because clang * does not support them. */ -#ifdef CONFIG_AVX2_OPT +#if defined(CONFIG_AVX512F_OPT) || defined(CONFIG_AVX2_OPT) #pragma GCC push_options #pragma GCC target("sse2") #endif @@ -104,7 +104,7 @@ buffer_zero_sse2(const void *buf, size_t len) =20 return _mm_movemask_epi8(_mm_cmpeq_epi8(t, zero)) =3D=3D 0xFFFF; } -#ifdef CONFIG_AVX2_OPT +#if defined(CONFIG_AVX512F_OPT) || defined(CONFIG_AVX2_OPT) #pragma GCC pop_options #endif =20 @@ -187,18 +187,54 @@ buffer_zero_avx2(const void *buf, size_t len) #pragma GCC pop_options #endif /* CONFIG_AVX2_OPT */ =20 +#ifdef CONFIG_AVX512F_OPT +#pragma GCC push_options +#pragma GCC target("avx512f") +#include + +static bool +buffer_zero_avx512(const void *buf, size_t len) +{ + /* Begin with an unaligned head of 64 bytes. */ + __m512i t =3D _mm512_loadu_si512(buf); + __m512i *p =3D (__m512i *)(((uintptr_t)buf + 5 * 64) & -64); + __m512i *e =3D (__m512i *)(((uintptr_t)buf + len) & -64); + + /* Loop over 64-byte aligned blocks of 256. */ + while (p <=3D e) { + __builtin_prefetch(p); + if (unlikely(_mm512_test_epi64_mask(t, t))) { + return false; + } + t =3D p[-4] | p[-3] | p[-2] | p[-1]; + p +=3D 4; + } + + t |=3D _mm512_loadu_si512(buf + len - 4 * 64); + t |=3D _mm512_loadu_si512(buf + len - 3 * 64); + t |=3D _mm512_loadu_si512(buf + len - 2 * 64); + t |=3D _mm512_loadu_si512(buf + len - 1 * 64); + + return !_mm512_test_epi64_mask(t, t); + +} +#pragma GCC pop_options +#endif + + /* Note that for test_buffer_is_zero_next_accel, the most preferred * ISA must have the least significant bit. */ -#define CACHE_AVX2 1 -#define CACHE_SSE4 2 -#define CACHE_SSE2 4 +#define CACHE_AVX512F 1 +#define CACHE_AVX2 2 +#define CACHE_SSE4 4 +#define CACHE_SSE2 8 =20 /* Make sure that these variables are appropriately initialized when * SSE2 is enabled on the compiler command-line, but the compiler is * too old to support CONFIG_AVX2_OPT. */ -#ifdef CONFIG_AVX2_OPT +#if defined(CONFIG_AVX512F_OPT) || defined(CONFIG_AVX2_OPT) # define INIT_CACHE 0 # define INIT_ACCEL buffer_zero_int #else @@ -211,25 +247,35 @@ buffer_zero_avx2(const void *buf, size_t len) =20 static unsigned cpuid_cache =3D INIT_CACHE; static bool (*buffer_accel)(const void *, size_t) =3D INIT_ACCEL; +static int length_to_accel; =20 static void init_accel(unsigned cache) { bool (*fn)(const void *, size_t) =3D buffer_zero_int; if (cache & CACHE_SSE2) { fn =3D buffer_zero_sse2; + length_to_accel =3D 64; } #ifdef CONFIG_AVX2_OPT if (cache & CACHE_SSE4) { fn =3D buffer_zero_sse4; + length_to_accel =3D 64; } if (cache & CACHE_AVX2) { fn =3D buffer_zero_avx2; + length_to_accel =3D 64; + } +#endif +#ifdef CONFIG_AVX512F_OPT + if (cache & CACHE_AVX512F) { + fn =3D buffer_zero_avx512; + length_to_accel =3D 256; } #endif buffer_accel =3D fn; } =20 -#ifdef CONFIG_AVX2_OPT +#if defined(CONFIG_AVX512F_OPT) || defined(CONFIG_AVX2_OPT) #include "qemu/cpuid.h" =20 static void __attribute__((constructor)) init_cpuid_cache(void) @@ -252,9 +298,17 @@ static void __attribute__((constructor)) init_cpuid_ca= che(void) int bv; __asm("xgetbv" : "=3Da"(bv), "=3Dd"(d) : "c"(0)); __cpuid_count(7, 0, a, b, c, d); - if ((bv & 6) =3D=3D 6 && (b & bit_AVX2)) { + if ((bv & 0x6) =3D=3D 0x6 && (b & bit_AVX2)) { cache |=3D CACHE_AVX2; } + /* 0xe6: + * XCR0[7:5] =3D 111b (OPMASK state, upper 256-bit of ZMM0-ZMM= 15 + * and ZMM16-ZMM31 state are enabled by OS) + * XCR0[2:1] =3D 11b (XMM state and YMM state are enabled by O= S) + */ + if ((bv & 0xe6) =3D=3D 0xe6 && (b & bit_AVX512F)) { + cache |=3D CACHE_AVX512F; + } } } cpuid_cache =3D cache; @@ -277,7 +331,7 @@ bool test_buffer_is_zero_next_accel(void) =20 static bool select_accel_fn(const void *buf, size_t len) { - if (likely(len >=3D 64)) { + if (likely(len >=3D length_to_accel)) { return buffer_accel(buf, len); } return buffer_zero_int(buf, len); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394660; cv=none; d=zohomail.com; s=zohoarc; b=THa4rg2zSSffwH8Fs42u1pquErkACH/Rlknp1EkRrcrT2EUfmNHcSIs2WB6IFSCajveS3YAF1Vz51HK9GgLpfittv/O5DhBQsUow9fM3/9BFOVPQxdVQYCEkSrHsUSJay2zao2V2rWMJrroNl/DQyFAekgQ07BRlh9Y6MMw5aow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394660; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=j62ivAGq+cHjzdhXhOseUOUWPMi7FTi7mgcgLS+k3MI=; b=MM21YcJJ92ssFRcj3uh9lLg29Zq2RFo5bEUIWoa/lH3l7w8rUvVESrvNHk12d79M/uxTRyabaWulL8PmJf5v60N5LbXPHqMVdRpIhbRB9jAxERAgdYimDKOcHMwvnhjmY04Ol71ihMq6u+p8eWBemZ4bIFeCO7GNJQj7SuQq8dk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394660073944.6703616281208; Mon, 16 Mar 2020 14:37:40 -0700 (PDT) Received: from localhost ([::1]:49362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxQY-0006u7-Ua for importer@patchew.org; Mon, 16 Mar 2020 17:37:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41523) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH4-0002Wr-5y for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxH1-0000gg-TK for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:50 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:21833) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxH1-0000bp-Mf for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-44-h3q9Uo5gNKSFspFxJ23Tiw-1; Mon, 16 Mar 2020 17:27:44 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 01880800D5B; Mon, 16 Mar 2020 21:27:44 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DF6719C4F; Mon, 16 Mar 2020 21:27:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394067; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j62ivAGq+cHjzdhXhOseUOUWPMi7FTi7mgcgLS+k3MI=; b=LFaioZp/WHDe7ywxp52GVnTnwhv7wmOnaqkByZHeuGqQMV2eh3oiQub4ccqa00QFgpObyS oT+k3ajchasBJcjQG6DWtJ1H2D4AonmQwh/Pbkr/toMCmi2zWYBJbhn2yvC2ZTUkcC2t4V f/KzUF5sl6P/nPGE98tMd+W6f3y6rWY= X-MC-Unique: h3q9Uo5gNKSFspFxJ23Tiw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 07/61] WHPX: TSC get and set should be dependent on VM state Date: Mon, 16 Mar 2020 22:26:34 +0100 Message-Id: <1584394048-44994-8-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Sunil Muthuswamy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sunil Muthuswamy Currently, TSC is set as part of the VM runtime state. Setting TSC at runtime is heavy and additionally can have side effects on the guest, which are not very resilient to variances in the TSC. This patch uses the VM state to determine whether to set TSC or not. Some minor enhancements for getting TSC values as well that considers the VM state. Additionally, while setting the TSC, the partition is suspended to reduce the variance in the TSC value across vCPUs. Signed-off-by: Sunil Muthuswamy Message-Id: Signed-off-by: Paolo Bonzini --- include/sysemu/whpx.h | 7 +++ target/i386/whp-dispatch.h | 9 ++++ target/i386/whpx-all.c | 103 +++++++++++++++++++++++++++++++++++++++++= ---- 3 files changed, 110 insertions(+), 9 deletions(-) diff --git a/include/sysemu/whpx.h b/include/sysemu/whpx.h index 4794e8e..a84b49e 100644 --- a/include/sysemu/whpx.h +++ b/include/sysemu/whpx.h @@ -35,4 +35,11 @@ int whpx_enabled(void); =20 #endif /* CONFIG_WHPX */ =20 +/* state subset only touched by the VCPU itself during runtime */ +#define WHPX_SET_RUNTIME_STATE 1 +/* state subset modified during VCPU reset */ +#define WHPX_SET_RESET_STATE 2 +/* full state set, modified during initialization or on vmload */ +#define WHPX_SET_FULL_STATE 3 + #endif /* QEMU_WHPX_H */ diff --git a/target/i386/whp-dispatch.h b/target/i386/whp-dispatch.h index 87d049c..e4695c3 100644 --- a/target/i386/whp-dispatch.h +++ b/target/i386/whp-dispatch.h @@ -23,6 +23,12 @@ X(HRESULT, WHvGetVirtualProcessorRegisters, (WHV_PARTITION_HANDLE Partit= ion, UINT32 VpIndex, const WHV_REGISTER_NAME* RegisterNames, UINT32 Registe= rCount, WHV_REGISTER_VALUE* RegisterValues)) \ X(HRESULT, WHvSetVirtualProcessorRegisters, (WHV_PARTITION_HANDLE Partit= ion, UINT32 VpIndex, const WHV_REGISTER_NAME* RegisterNames, UINT32 Registe= rCount, const WHV_REGISTER_VALUE* RegisterValues)) \ =20 +/* + * These are supplemental functions that may not be present + * on all versions and are not critical for basic functionality. + */ +#define LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(X) \ + X(HRESULT, WHvSuspendPartitionTime, (WHV_PARTITION_HANDLE Partition)) \ =20 #define LIST_WINHVEMULATION_FUNCTIONS(X) \ X(HRESULT, WHvEmulatorCreateEmulator, (const WHV_EMULATOR_CALLBACKS* Cal= lbacks, WHV_EMULATOR_HANDLE* Emulator)) \ @@ -40,10 +46,12 @@ /* Define function typedef */ LIST_WINHVPLATFORM_FUNCTIONS(WHP_DEFINE_TYPE) LIST_WINHVEMULATION_FUNCTIONS(WHP_DEFINE_TYPE) +LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DEFINE_TYPE) =20 struct WHPDispatch { LIST_WINHVPLATFORM_FUNCTIONS(WHP_DECLARE_MEMBER) LIST_WINHVEMULATION_FUNCTIONS(WHP_DECLARE_MEMBER) + LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_DECLARE_MEMBER) }; =20 extern struct WHPDispatch whp_dispatch; @@ -53,6 +61,7 @@ bool init_whp_dispatch(void); typedef enum WHPFunctionList { WINHV_PLATFORM_FNS_DEFAULT, WINHV_EMULATION_FNS_DEFAULT, + WINHV_PLATFORM_FNS_SUPPLEMENTAL } WHPFunctionList; =20 #endif /* WHP_DISPATCH_H */ diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index 683d49d..b947eb1 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -114,7 +114,6 @@ static const WHV_REGISTER_NAME whpx_register_names[] = =3D { WHvX64RegisterXmmControlStatus, =20 /* X64 MSRs */ - WHvX64RegisterTsc, WHvX64RegisterEfer, #ifdef TARGET_X86_64 WHvX64RegisterKernelGsBase, @@ -215,7 +214,44 @@ static SegmentCache whpx_seg_h2q(const WHV_X64_SEGMENT= _REGISTER *hs) return qs; } =20 -static void whpx_set_registers(CPUState *cpu) +static int whpx_set_tsc(CPUState *cpu) +{ + struct CPUX86State *env =3D (CPUArchState *)(cpu->env_ptr); + WHV_REGISTER_NAME tsc_reg =3D WHvX64RegisterTsc; + WHV_REGISTER_VALUE tsc_val; + HRESULT hr; + struct whpx_state *whpx =3D &whpx_global; + + /* + * Suspend the partition prior to setting the TSC to reduce the varian= ce + * in TSC across vCPUs. When the first vCPU runs post suspend, the + * partition is automatically resumed. + */ + if (whp_dispatch.WHvSuspendPartitionTime) { + + /* + * Unable to suspend partition while setting TSC is not a fatal + * error. It just increases the likelihood of TSC variance between + * vCPUs and some guest OS are able to handle that just fine. + */ + hr =3D whp_dispatch.WHvSuspendPartitionTime(whpx->partition); + if (FAILED(hr)) { + warn_report("WHPX: Failed to suspend partition, hr=3D%08lx", h= r); + } + } + + tsc_val.Reg64 =3D env->tsc; + hr =3D whp_dispatch.WHvSetVirtualProcessorRegisters( + whpx->partition, cpu->cpu_index, &tsc_reg, 1, &tsc_val); + if (FAILED(hr)) { + error_report("WHPX: Failed to set TSC, hr=3D%08lx", hr); + return -1; + } + + return 0; +} + +static void whpx_set_registers(CPUState *cpu, int level) { struct whpx_state *whpx =3D &whpx_global; struct whpx_vcpu *vcpu =3D get_whpx_vcpu(cpu); @@ -230,6 +266,14 @@ static void whpx_set_registers(CPUState *cpu) =20 assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); =20 + /* + * Following MSRs have side effects on the guest or are too heavy for + * runtime. Limit them to full state update. + */ + if (level >=3D WHPX_SET_RESET_STATE) { + whpx_set_tsc(cpu); + } + memset(&vcxt, 0, sizeof(struct whpx_register_set)); =20 v86 =3D (env->eflags & VM_MASK); @@ -330,8 +374,6 @@ static void whpx_set_registers(CPUState *cpu) idx +=3D 1; =20 /* MSRs */ - assert(whpx_register_names[idx] =3D=3D WHvX64RegisterTsc); - vcxt.values[idx++].Reg64 =3D env->tsc; assert(whpx_register_names[idx] =3D=3D WHvX64RegisterEfer); vcxt.values[idx++].Reg64 =3D env->efer; #ifdef TARGET_X86_64 @@ -379,6 +421,25 @@ static void whpx_set_registers(CPUState *cpu) return; } =20 +static int whpx_get_tsc(CPUState *cpu) +{ + struct CPUX86State *env =3D (CPUArchState *)(cpu->env_ptr); + WHV_REGISTER_NAME tsc_reg =3D WHvX64RegisterTsc; + WHV_REGISTER_VALUE tsc_val; + HRESULT hr; + struct whpx_state *whpx =3D &whpx_global; + + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters( + whpx->partition, cpu->cpu_index, &tsc_reg, 1, &tsc_val); + if (FAILED(hr)) { + error_report("WHPX: Failed to get TSC, hr=3D%08lx", hr); + return -1; + } + + env->tsc =3D tsc_val.Reg64; + return 0; +} + static void whpx_get_registers(CPUState *cpu) { struct whpx_state *whpx =3D &whpx_global; @@ -394,6 +455,11 @@ static void whpx_get_registers(CPUState *cpu) =20 assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu)); =20 + if (!env->tsc_valid) { + whpx_get_tsc(cpu); + env->tsc_valid =3D !runstate_is_running(); + } + hr =3D whp_dispatch.WHvGetVirtualProcessorRegisters( whpx->partition, cpu->cpu_index, whpx_register_names, @@ -492,8 +558,6 @@ static void whpx_get_registers(CPUState *cpu) idx +=3D 1; =20 /* MSRs */ - assert(whpx_register_names[idx] =3D=3D WHvX64RegisterTsc); - env->tsc =3D vcxt.values[idx++].Reg64; assert(whpx_register_names[idx] =3D=3D WHvX64RegisterEfer); env->efer =3D vcxt.values[idx++].Reg64; #ifdef TARGET_X86_64 @@ -896,7 +960,7 @@ static int whpx_vcpu_run(CPUState *cpu) =20 do { if (cpu->vcpu_dirty) { - whpx_set_registers(cpu); + whpx_set_registers(cpu, WHPX_SET_RUNTIME_STATE); cpu->vcpu_dirty =3D false; } =20 @@ -1074,14 +1138,14 @@ static void do_whpx_cpu_synchronize_state(CPUState = *cpu, run_on_cpu_data arg) static void do_whpx_cpu_synchronize_post_reset(CPUState *cpu, run_on_cpu_data arg) { - whpx_set_registers(cpu); + whpx_set_registers(cpu, WHPX_SET_RESET_STATE); cpu->vcpu_dirty =3D false; } =20 static void do_whpx_cpu_synchronize_post_init(CPUState *cpu, run_on_cpu_data arg) { - whpx_set_registers(cpu); + whpx_set_registers(cpu, WHPX_SET_FULL_STATE); cpu->vcpu_dirty =3D false; } =20 @@ -1123,6 +1187,15 @@ void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu) =20 static Error *whpx_migration_blocker; =20 +static void whpx_cpu_update_state(void *opaque, int running, RunState stat= e) +{ + CPUX86State *env =3D opaque; + + if (running) { + env->tsc_valid =3D false; + } +} + int whpx_init_vcpu(CPUState *cpu) { HRESULT hr; @@ -1178,6 +1251,7 @@ int whpx_init_vcpu(CPUState *cpu) =20 cpu->vcpu_dirty =3D true; cpu->hax_vcpu =3D (struct hax_vcpu_state *)vcpu; + qemu_add_vm_change_state_handler(whpx_cpu_update_state, cpu->env_ptr); =20 return 0; } @@ -1367,6 +1441,10 @@ static bool load_whp_dispatch_fns(HMODULE *handle, =20 #define WINHV_PLATFORM_DLL "WinHvPlatform.dll" #define WINHV_EMULATION_DLL "WinHvEmulation.dll" + #define WHP_LOAD_FIELD_OPTIONAL(return_type, function_name, signature)= \ + whp_dispatch.function_name =3D \ + (function_name ## _t)GetProcAddress(hLib, #function_name); \ + #define WHP_LOAD_FIELD(return_type, function_name, signature) \ whp_dispatch.function_name =3D \ (function_name ## _t)GetProcAddress(hLib, #function_name); \ @@ -1394,6 +1472,11 @@ static bool load_whp_dispatch_fns(HMODULE *handle, WHP_LOAD_LIB(WINHV_EMULATION_DLL, hLib) LIST_WINHVEMULATION_FUNCTIONS(WHP_LOAD_FIELD) break; + + case WINHV_PLATFORM_FNS_SUPPLEMENTAL: + WHP_LOAD_LIB(WINHV_PLATFORM_DLL, hLib) + LIST_WINHVPLATFORM_FUNCTIONS_SUPPLEMENTAL(WHP_LOAD_FIELD_OPTIONAL) + break; } =20 *handle =3D hLib; @@ -1554,6 +1637,8 @@ bool init_whp_dispatch(void) goto error; } =20 + assert(load_whp_dispatch_fns(&hWinHvPlatform, + WINHV_PLATFORM_FNS_SUPPLEMENTAL)); whp_dispatch_initialized =3D true; =20 return true; --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394186; cv=none; d=zohomail.com; s=zohoarc; b=ilMyLhb27SLw/Rl+pdCHmMKn/LTMjW61DlFdKOATFBIAeOEvHFB1/6q2JQpzlmU6kePj5oUbVN6M9QrzZKvpA6NfnOXRO0ejdpjRGRJQIqGx909lm+99p397psYgNHrgJ0YYGd0e7dErLlz8DawV+fkYXMe05bsqDM9tR8GU5SI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394186; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=CuM6HjQBtuKhH+tgQISPrj7uZw8Cf0Ok4K0Lu3+tI5Y=; b=O8vKOXuftiU0MWGYl3wsyhOPOnRVKrzjn+VcrF+NeyXaxN2fJ1IMQiS9iDmlDHc7O44bgif6NZcwbEmIPRx7n9jP090BB6RfM96IoO7qwLBt/Q4upAXZiqeQsmfE01btuleywWnltqpQ/znc7kL/LUnGziPfsi+7R5jVDk7IgGc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394186260580.3593425726673; Mon, 16 Mar 2020 14:29:46 -0700 (PDT) Received: from localhost ([::1]:49244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIv-0004za-4v for importer@patchew.org; Mon, 16 Mar 2020 17:29:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41544) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH4-0002Xy-NS for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxH3-0000qM-2q for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:50 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:23862) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxH2-0000lv-Rr for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-484-xQO1e_9ePBGz64qBxz7oLg-1; Mon, 16 Mar 2020 17:27:46 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FF57107ACC7; Mon, 16 Mar 2020 21:27:45 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6B9EE19C4F; Mon, 16 Mar 2020 21:27:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394068; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CuM6HjQBtuKhH+tgQISPrj7uZw8Cf0Ok4K0Lu3+tI5Y=; b=QUGyoiidgVuHRLBG4NNRRF5SMs3JKUyv/j76KZzS2kZeLZashgfoDnMb/49jtZ6Ef9VCak NISUsvMkEegmOlYLWbm5qnFcuca3K0yXk45ddI0x886Y9rh+qMZvoLwnO06BUpO25L9VcG XlnL8PL0zAfx9QrOMZQ/M/FTmpeORSQ= X-MC-Unique: xQO1e_9ePBGz64qBxz7oLg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 08/61] WHPX: Use QEMU values for trapped CPUID Date: Mon, 16 Mar 2020 22:26:35 +0100 Message-Id: <1584394048-44994-9-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Sunil Muthuswamy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sunil Muthuswamy Currently, WHPX is using some default values for the trapped CPUID functions. These were not in sync with the QEMU values because the CPUID values were never set with WHPX during VCPU initialization. Additionally, at the moment, WHPX doesn't support setting CPUID values in the hypervisor at runtime (i.e. after the partition has been setup). That is needed to be able to set the CPUID values in the hypervisor during VCPU init. Until that support comes, use the QEMU values for the trapped CPUIDs. Signed-off-by: Sunil Muthuswamy Message-Id: Signed-off-by: Paolo Bonzini --- target/i386/whpx-all.c | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index b947eb1..cb863b7 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -1044,38 +1044,32 @@ static int whpx_vcpu_run(CPUState *cpu) WHV_REGISTER_VALUE reg_values[5]; WHV_REGISTER_NAME reg_names[5]; UINT32 reg_count =3D 5; - UINT64 rip, rax, rcx, rdx, rbx; + UINT64 cpuid_fn, rip =3D 0, rax =3D 0, rcx =3D 0, rdx =3D 0, r= bx =3D 0; + X86CPU *x86_cpu =3D X86_CPU(cpu); + CPUX86State *env =3D &x86_cpu->env; =20 memset(reg_values, 0, sizeof(reg_values)); =20 rip =3D vcpu->exit_ctx.VpContext.Rip + vcpu->exit_ctx.VpContext.InstructionLength; - switch (vcpu->exit_ctx.CpuidAccess.Rax) { - case 1: - rax =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRax; - /* Advertise that we are running on a hypervisor */ - rcx =3D - vcpu->exit_ctx.CpuidAccess.DefaultResultRcx | - CPUID_EXT_HYPERVISOR; - - rdx =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRdx; - rbx =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRbx; - break; + cpuid_fn =3D vcpu->exit_ctx.CpuidAccess.Rax; + + /* + * Ideally, these should be supplied to the hypervisor during = VCPU + * initialization and it should be able to satisfy this reques= t. + * But, currently, WHPX doesn't support setting CPUID values i= n the + * hypervisor once the partition has been setup, which is too = late + * since VCPUs are realized later. For now, use the values from + * QEMU to satisfy these requests, until WHPX adds support for + * being able to set these values in the hypervisor at runtime. + */ + cpu_x86_cpuid(env, cpuid_fn, 0, (UINT32 *)&rax, (UINT32 *)&rbx, + (UINT32 *)&rcx, (UINT32 *)&rdx); + switch (cpuid_fn) { case 0x80000001: - rax =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRax; /* Remove any support of OSVW */ - rcx =3D - vcpu->exit_ctx.CpuidAccess.DefaultResultRcx & - ~CPUID_EXT3_OSVW; - - rdx =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRdx; - rbx =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRbx; + rcx &=3D ~CPUID_EXT3_OSVW; break; - default: - rax =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRax; - rcx =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRcx; - rdx =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRdx; - rbx =3D vcpu->exit_ctx.CpuidAccess.DefaultResultRbx; } =20 reg_names[0] =3D WHvX64RegisterRip; --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394660; cv=none; d=zohomail.com; s=zohoarc; b=aczPfJa3x1RsQJPoCUCTWOqQB0qZBX5C0ErWvUI2H0FcT+k90HlSxRzQm1+S7mzYz7pB2k3Z9GFsYIiJD7dmESM3XqqIYtsn/UvFJzXaYF3rxDNfAMqbtyOTfidf6FdD4Z8HLTMpuE6KA0zu6jRPQGyC5tgwbQyLcAMDq7EDsd4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394660; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=gii0zFCkcbzpyNXdbmeol5gPqR3ynMa+1Vb+XoSHx5A=; b=A3J/L723NzltuSSsgsv3OKbVO/I5K98kdiq6dTiYt66JyKGPBf685djfMa8Ad1kR3IWCiYaxINebod/8/5+8Tcu9KdVJYzZFlVWx1yZDzd4wN1byXta5TCkcYt1TY8Yns3HL+s2a0d2HzhdILsx6/Hf8SiLgSnhOzrj03m4ZODA= 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 1584394660186706.3704216145281; Mon, 16 Mar 2020 14:37:40 -0700 (PDT) Received: from localhost ([::1]:49364 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxQZ-0006w6-4u for importer@patchew.org; Mon, 16 Mar 2020 17:37:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41620) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH7-0002eE-PX for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxH6-0001K3-Lh for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:53 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:47723) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxH6-0001J0-HU for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-133-XTY4btvkNwOZlUfviokn5w-1; Mon, 16 Mar 2020 17:27:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 357AD100550E; Mon, 16 Mar 2020 21:27:47 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id C7E5419C4F; Mon, 16 Mar 2020 21:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394072; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gii0zFCkcbzpyNXdbmeol5gPqR3ynMa+1Vb+XoSHx5A=; b=PAG+O/333amLOis6OJmM4jCEnF7srYH15WiM1Omys4fmpzwDA0loXuwwAEMiXvFKqAAxvg gnVV0ArE0EE0ww5Id9Ylh1gH0eGuf9Jspp7yWiazdD1TrrxYXgpwwKSD1ydpwd8kaVHAC3 fpkG/p2F4laEQEY6MZHbmC1HN9Zw1ns= X-MC-Unique: XTY4btvkNwOZlUfviokn5w-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 09/61] MAINTAINERS: Add entry for Guest X86 HAXM CPUs Date: Mon, 16 Mar 2020 22:26:36 +0100 Message-Id: <1584394048-44994-10-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Hang Yuan , Colin Xu , Wenchao Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Colin Xu HAXM covers below files: include/sysemu/hax.h target/i386/hax-* V2: Add HAXM github page for wiki and issue tracking. Cc: Wenchao Wang Cc: Hang Yuan Reviewed-by: Hang Yuan Signed-off-by: Colin Xu Message-Id: <20200228012046.6629-1-colin.xu@intel.com> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 32867bc..a88bc28 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -436,6 +436,17 @@ F: include/hw/block/dataplane/xen* F: include/hw/xen/ F: include/sysemu/xen-mapcache.h =20 +Guest CPU Cores (HAXM) +--------------------- +X86 HAXM CPUs +M: Wenchao Wang +M: Colin Xu +L: haxm-team@intel.com +W: https://github.com/intel/haxm/issues +S: Maintained +F: include/sysemu/hax.h +F: target/i386/hax-* + Hosts ----- LINUX --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394353; cv=none; d=zohomail.com; s=zohoarc; b=Rpl8BWgeXxbI4PW2OqUyGYPjMBB0V3+e4qsssJQGx6xtOCV+qhBrWkmvlMsA3YjChAAdNQo83/56RQIsn7x1MXtbacP2ut8Y+kxmRwi0k9p4srmzWEhMGgxSQyNfUq9aZBHp09QsdwrKir5TcrEgwc3CldNkRt8v8yFancRIJc0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394353; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=OpyLmBYXbHHno355Cd3qs+A0HW7Dz+VqgNCky54LzlY=; b=NfMK8sF9CvHqB4qyNQ7PtH7IMBTxjljOtFn6KIgbHNWEJ6ATOw5XCrCze+iV/VSAUL32FJKs2xqhM/OHW4EePhTbB+FQtK+TYYR0s/AWNnyEDNaIaisrNGTLR6LDOUHfqva/O6FI0ebUz4d6FGwwSLKlyUVCguN9QzMuQvoS3PQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394353901891.7504639304727; Mon, 16 Mar 2020 14:32:33 -0700 (PDT) Received: from localhost ([::1]:49298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxLc-00083c-PM for importer@patchew.org; Mon, 16 Mar 2020 17:32:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41603) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxH7-0002dG-Au for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxH6-0001Io-95 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:53 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:55623) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxH6-0001EX-3f for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:52 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-476-WUsJ2d4FP6q6JSS1iG2SjA-1; Mon, 16 Mar 2020 17:27:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91BC61804540; Mon, 16 Mar 2020 21:27:48 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A081C19C4F; Mon, 16 Mar 2020 21:27:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394071; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OpyLmBYXbHHno355Cd3qs+A0HW7Dz+VqgNCky54LzlY=; b=LoePp8UD5C1j+y8QImUF409E1UQL2C3cNqE7TA8sqleX45+O8PglI+R1BiuuZJtGq9IcCi KOp7pl0RbyGyxBPjj6yUgwu7+yqVMlsLDXuKHo98quKv+zmfUDD3yr/IqbLR2abt9Og6WR MQD4bGqEUfzk4smseyLYUvHcyIMKOwg= X-MC-Unique: WUsJ2d4FP6q6JSS1iG2SjA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 10/61] hw/i386/intel_iommu: Fix out-of-bounds access on guest IRT Date: Mon, 16 Mar 2020 22:26:37 +0100 Message-Id: <1584394048-44994-11-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Jan Kiszka Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Jan Kiszka vtd_irte_get failed to check the index against the configured table size, causing an out-of-bounds access on guest memory and potentially misinterpreting the result. Signed-off-by: Jan Kiszka Message-Id: <4b15b728-bdfe-3bbe-3a5c-ca3baeef3c5c@siemens.com> Signed-off-by: Paolo Bonzini --- hw/i386/intel_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c index 204b684..df7ad25 100644 --- a/hw/i386/intel_iommu.c +++ b/hw/i386/intel_iommu.c @@ -3094,6 +3094,12 @@ static int vtd_irte_get(IntelIOMMUState *iommu, uint= 16_t index, uint16_t mask, source_id; uint8_t bus, bus_max, bus_min; =20 + if (index >=3D iommu->intr_size) { + error_report_once("%s: index too large: ind=3D0x%x", + __func__, index); + return -VTD_FR_IR_INDEX_OVER; + } + addr =3D iommu->intr_root + index * sizeof(*entry); if (dma_memory_read(&address_space_memory, addr, entry, sizeof(*entry))) { --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394802; cv=none; d=zohomail.com; s=zohoarc; b=mCQzBrPk5qw5/lOrUV03POUYIvHSBVVfzKdpcoSvLOAMM0bgyj/f5mzrh21BXe3r+57OjY3/83G7ulC8VMTOljxWz2NTGzEY25SgczZFqwAYhOSEvPRtXpd2oQYE2UZRMLbW7Zy37XL1W2jbdDJLb/yZWp+352/+Kim/H02Cl6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394802; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=nWSk6fKinz3OKAkyJIg3XMJxGORt82Mgq21y0f1z+g4=; b=UfhrE+WxxFZJnp/0ipbBfxg2EhMMRa18ueGrGcLj+7uAHMk++7z7g99QHSdlN0gM8awtFMHvg3pLrT14YS533NViETMZFDh+NPi8bkbEbXxlPYg1QLvUtK+9EkovCYHq+YifFPNPmY/FekWiY/AcNWPC/3ExHZBpVlrMim9d1ZM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394802068606.2007348627295; Mon, 16 Mar 2020 14:40:02 -0700 (PDT) Received: from localhost ([::1]:49392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxSq-0002GI-My for importer@patchew.org; Mon, 16 Mar 2020 17:40:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41682) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHA-0002kr-Be for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxH9-0001dE-2Q for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:56 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:49691) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxH8-0001Z0-Sw for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:27:54 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-46-615sNznOMaWIoWjimy4NEQ-1; Mon, 16 Mar 2020 17:27:50 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F2E268017DF; Mon, 16 Mar 2020 21:27:49 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07B3719C4F; Mon, 16 Mar 2020 21:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394074; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nWSk6fKinz3OKAkyJIg3XMJxGORt82Mgq21y0f1z+g4=; b=a7AMfBoXmErQQnFqcJC8g7Au7A+tcb1nSGWaReOURl8WU8zhbgC9bhLPZm+a+oFdN6TVC9 VcXiYMzt73JbJB6cu4qT5v72UfakkGltwSAIDCM8R3MhDrhf58m6r0CVeLM1EhUM9WSKD+ mxsUojmGnGWnlwvFBveTz+L0V0NUdBs= X-MC-Unique: 615sNznOMaWIoWjimy4NEQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 11/61] oslib-posix: initialize mutex and condition variable Date: Mon, 16 Mar 2020 22:26:38 +0100 Message-Id: <1584394048-44994-12-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: bauerchen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The mutex and condition variable were never initialized, causing -mem-prealloc to abort with an assertion failure. Fixes: 037fb5eb3941c80a2b7c36a843e47207ddb004d4 Reported-by: Marc Hartmayer Cc: bauerchen Signed-off-by: Paolo Bonzini --- util/oslib-posix.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 897e8f3..4dd6d7d 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -466,10 +466,17 @@ static inline int get_memset_num_threads(int smp_cpus) static bool touch_all_pages(char *area, size_t hpagesize, size_t numpages, int smp_cpus) { + static gsize initialized =3D 0; size_t numpages_per_thread, leftover; char *addr =3D area; int i =3D 0; =20 + if (g_once_init_enter(&initialized)) { + qemu_mutex_init(&page_mutex); + qemu_cond_init(&page_cond); + g_once_init_leave(&initialized, 1); + } + memset_thread_failed =3D false; threads_created_flag =3D false; memset_num_threads =3D get_memset_num_threads(smp_cpus); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394446; cv=none; d=zohomail.com; s=zohoarc; b=lKp65yK2K5s9YvwUc9qSqQ24AfiePHpgn72N/z9mKFInyrpUlj8lFAhlVkDtXgCz4Um+IfL2cMusWb4AVoDd7cTwzfry5FTH9wt11qlj+/45wYObf0hAL6rdfN50ILYkihwjX5ufgGCm+Tpqy2EQyUX/4GaVTdxBEZ1UKsTgoj8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394446; 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=NTHE5XrNCt2Y1BWJERvCGNKHLBh/laOkgh5BdDwVuzQ=; b=dEe7g3MKScXGDfY48faRwQAcjhYbHjCgM7Q1ZlrQtZSPAC6Bq5gnmbAPmnfAKe0/XDmXr5QHqFvCLSVSejeSiV5uU6xtq16lyogfviOUJfxq43OieGjQy6rgOr1ZTZKrfxxJ9HQZICy2XEgW33DPV9QUatY3+J7Y72AGy3Z8hz0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394446761220.25988450514262; Mon, 16 Mar 2020 14:34:06 -0700 (PDT) Received: from localhost ([::1]:49320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxN7-0001aY-L1 for importer@patchew.org; Mon, 16 Mar 2020 17:34:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41976) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHM-0003BF-8z for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHK-0003DS-QQ for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:08 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:55553) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHK-00038y-Kd for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:06 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-iQNIO709NBe2-3ONOnAMkA-1; Mon, 16 Mar 2020 17:27:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CF6208017DF for ; Mon, 16 Mar 2020 21:27:53 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67CC619C4F; Mon, 16 Mar 2020 21:27:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394086; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NTHE5XrNCt2Y1BWJERvCGNKHLBh/laOkgh5BdDwVuzQ=; b=I+nXSBYYYYjr5k+DAxYeZ+QFctar0dXp7ZWWod3Ef/aMWwnYd5eCkqnEXO44V1dskcNmB3 m69LRulz+0t8ng8MWlVoYKoQ6uTZsrZgfSrVMzC2sIUr2Agzbkv+RdBa4x7TnobBPfheX1 uuyMmyajZXX/+s4G7ANQZHSLT9T0QEQ= X-MC-Unique: iQNIO709NBe2-3ONOnAMkA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 12/61] build-sys: do not make qemu-ga link with pixman Date: Mon, 16 Mar 2020 22:26:39 +0100 Message-Id: <1584394048-44994-13-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Marc-Andr=C3=A9 Lureau Since commit d52c454aadcdae74506f315ebf8b58bb79a05573 ("contrib: add vhost-user-gpu"), qemu-ga is linking with pixman. This is because the Make-based build-system use a global namespace for variables, and we rely on "main.o-libs" for different linking targets. Note: this kind of variable clashing is hard to fix or prevent currently. meson should help, as declarations have a linear dependency and doesn't rely so much on variables and clever tricks. Note2: we have a lot of main.c (or other duplicated names!) in tree. Imho, it would be annoying and a bad workaroud to rename all those to avoid conflicts like I did here. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=3D1811670 Signed-off-by: Marc-Andr=C3=A9 Lureau Message-Id: <20200311160923.882474-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- contrib/vhost-user-gpu/Makefile.objs | 6 +++--- contrib/vhost-user-gpu/{main.c =3D> vhost-user-gpu.c} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename contrib/vhost-user-gpu/{main.c =3D> vhost-user-gpu.c} (100%) diff --git a/contrib/vhost-user-gpu/Makefile.objs b/contrib/vhost-user-gpu/= Makefile.objs index 6170c91..0929609 100644 --- a/contrib/vhost-user-gpu/Makefile.objs +++ b/contrib/vhost-user-gpu/Makefile.objs @@ -1,7 +1,7 @@ -vhost-user-gpu-obj-y =3D main.o virgl.o vugbm.o +vhost-user-gpu-obj-y =3D vhost-user-gpu.o virgl.o vugbm.o =20 -main.o-cflags :=3D $(PIXMAN_CFLAGS) $(GBM_CFLAGS) -main.o-libs :=3D $(PIXMAN_LIBS) +vhost-user-gpu.o-cflags :=3D $(PIXMAN_CFLAGS) $(GBM_CFLAGS) +vhost-user-gpu.o-libs :=3D $(PIXMAN_LIBS) =20 virgl.o-cflags :=3D $(VIRGL_CFLAGS) $(GBM_CFLAGS) virgl.o-libs :=3D $(VIRGL_LIBS) diff --git a/contrib/vhost-user-gpu/main.c b/contrib/vhost-user-gpu/vhost-u= ser-gpu.c similarity index 100% rename from contrib/vhost-user-gpu/main.c rename to contrib/vhost-user-gpu/vhost-user-gpu.c --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394799; cv=none; d=zohomail.com; s=zohoarc; b=LQCAG6Qn3F2xOItXVGeXvMSG8eYqwEha3XwXAaGDboMedUJgFzNz06NE4OAEdpzZ+Bg51zXVpGi8dwm4OB9zk5jtDyM33mLj7w92+ZrdMeL7CQ2jEFmla7omAeAgAmP5VveYuCKxaT6vua/HqPhFdDySQrruh5mKRHiy/3+VXic= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394799; 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=Wa22nO3jb2R+tsyGVtCtX3AeAERtIHhXj/xa1okN7VA=; b=h4dLzsoPANqL42xeNIfJnmUeJCZUbNjHebFYkFHLcvv1NZW9ph3E2cucUldNrlhc+humdXpOOFYQ9aRll8rwC74Gv41ti/2Odj9CrhAoa4nZJQSpKg9kYqwqQqqUv5x9mwTkMVSHjsJ75/CoC3wtpOPSOtjsh0bKiWUyxIe7e3c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394799444963.0543804863005; Mon, 16 Mar 2020 14:39:59 -0700 (PDT) Received: from localhost ([::1]:49390 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxSo-0002Bn-DV for importer@patchew.org; Mon, 16 Mar 2020 17:39:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41861) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHI-00032U-61 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHG-0002hk-GF for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:04 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:48799) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHG-0002eo-9u for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-LQEjZEiFOvKIOx3azaTLcg-1; Mon, 16 Mar 2020 17:27:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A590800D5B; Mon, 16 Mar 2020 21:27:55 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 457D819C4F; Mon, 16 Mar 2020 21:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394082; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Wa22nO3jb2R+tsyGVtCtX3AeAERtIHhXj/xa1okN7VA=; b=SuOF+c+T/I6ZXEZHWdHt8qMM/bToLCE+pQtbynOk0yNR/tAdXmjlBAJjkTBOhsaxWpZbvj xiF39etTG0y2wFRwyqqDAALAFxTcfFsGg6WUcVPZuqNMqm+V5yLiNJw3c/Nr2OUwhVok6F puZxfxo8JRNvVCLDtHgtzWilR3Vtc7g= X-MC-Unique: LQEjZEiFOvKIOx3azaTLcg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 13/61] modules: load modules from versioned /var/run dir Date: Mon, 16 Mar 2020 22:26:40 +0100 Message-Id: <1584394048-44994-14-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Christian Ehrhardt Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Christian Ehrhardt On upgrades the old .so files usually are replaced. But on the other hand since a qemu process represents a guest instance it is usually kept around. That makes late addition of dynamic features e.g. 'hot-attach of a ceph disk' fail by trying to load a new version of e.f. block-rbd.so into an old still running qemu binary. This adds a fallback to also load modules from a versioned directory in the temporary /var/run path. That way qemu is providing a way for packaging to store modules of an upgraded qemu package as needed until the next reboo= t. An example how that can then be used in packaging can be seen in: https://git.launchpad.net/~paelzer/ubuntu/+source/qemu/log/?h=3Dbug-1847361= -miss-old-so-on-upgrade-UBUNTU Fixes: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1847361 Signed-off-by: Christian Ehrhardt Reviewed-by: Daniel P. Berrang=C3=A9 Message-Id: <20200310145806.18335-2-christian.ehrhardt@canonical.com> Signed-off-by: Paolo Bonzini --- configure | 15 +++++++++++++++ util/module.c | 14 ++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/configure b/configure index 1a82683..a7f2c3e 100755 --- a/configure +++ b/configure @@ -405,6 +405,7 @@ EXESUF=3D"" DSOSUF=3D".so" LDFLAGS_SHARED=3D"-shared" modules=3D"no" +module_upgrades=3D"no" prefix=3D"/usr/local" mandir=3D"\${prefix}/share/man" datadir=3D"\${prefix}/share" @@ -1032,6 +1033,10 @@ for opt do --disable-modules) modules=3D"no" ;; + --disable-module-upgrades) module_upgrades=3D"no" + ;; + --enable-module-upgrades) module_upgrades=3D"yes" + ;; --cpu=3D*) ;; --target-list=3D*) target_list=3D"$optarg" @@ -1791,6 +1796,7 @@ disabled with --disable-FEATURE, default is enabled i= f available: guest-agent-msi build guest agent Windows MSI installation package pie Position Independent Executables modules modules support (non-Windows) + module-upgrades try to load modules from alternate paths for upgrades debug-tcg TCG debugging (default is disabled) debug-info debugging information sparse sparse checker @@ -2055,6 +2061,11 @@ if test "$modules" =3D "yes" && test "$mingw32" =3D = "yes" ; then error_exit "Modules are not available for Windows" fi =20 +# module_upgrades is only reasonable if modules are enabled +if test "$modules" =3D "no" && test "$module_upgrades" =3D "yes" ; then + error_exit "Can't enable module-upgrades as Modules are not enabled" +fi + # Static linking is not possible with modules or PIE if test "$static" =3D "yes" ; then if test "$modules" =3D "yes" ; then @@ -6626,6 +6637,7 @@ if test "$slirp" !=3D "no" ; then echo "smbd $smbd" fi echo "module support $modules" +echo "alt path mod load $module_upgrades" echo "host CPU $cpu" echo "host big endian $bigendian" echo "target list $target_list" @@ -6980,6 +6992,9 @@ if test "$modules" =3D "yes"; then echo "CONFIG_STAMP=3D_$( (echo $qemu_version; echo $pkgversion; cat $0) = | $shacmd - | cut -f1 -d\ )" >> $config_host_mak echo "CONFIG_MODULES=3Dy" >> $config_host_mak fi +if test "$module_upgrades" =3D "yes"; then + echo "CONFIG_MODULE_UPGRADES=3Dy" >> $config_host_mak +fi if test "$have_x11" =3D "yes" && test "$need_x11" =3D "yes"; then echo "CONFIG_X11=3Dy" >> $config_host_mak echo "X11_CFLAGS=3D$x11_cflags" >> $config_host_mak diff --git a/util/module.c b/util/module.c index 236a7bb..5f78968 100644 --- a/util/module.c +++ b/util/module.c @@ -19,6 +19,9 @@ #endif #include "qemu/queue.h" #include "qemu/module.h" +#ifdef CONFIG_MODULE_UPGRADES +#include "qemu-version.h" +#endif =20 typedef struct ModuleEntry { @@ -170,6 +173,9 @@ bool module_load_one(const char *prefix, const char *li= b_name) #ifdef CONFIG_MODULES char *fname =3D NULL; char *exec_dir; +#ifdef CONFIG_MODULE_UPGRADES + char *version_dir; +#endif const char *search_dir; char *dirs[4]; char *module_name; @@ -201,6 +207,14 @@ bool module_load_one(const char *prefix, const char *l= ib_name) dirs[n_dirs++] =3D g_strdup_printf("%s", CONFIG_QEMU_MODDIR); dirs[n_dirs++] =3D g_strdup_printf("%s/..", exec_dir ? : ""); dirs[n_dirs++] =3D g_strdup_printf("%s", exec_dir ? : ""); + +#ifdef CONFIG_MODULE_UPGRADES + version_dir =3D g_strcanon(g_strdup(QEMU_PKGVERSION), + G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "+-.~= ", + '_'); + dirs[n_dirs++] =3D g_strdup_printf("/var/run/qemu/%s", version_dir); +#endif + assert(n_dirs <=3D ARRAY_SIZE(dirs)); =20 g_free(exec_dir); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394514; cv=none; d=zohomail.com; s=zohoarc; b=d6Pyj1z/LdSc+FZAKY7vaRvAB+AaUZiUmWtchp2sz3JUmhbaKNzH0dZMzsYMC7wI2a2QnwVpPD+UeQYAfIa+qetAIvRkNX/yrC/db08jU4BzEjw2mL7Lp0TJpJT7g1W2i04/BtGzI6LTHoYZ/iZ84zYMCcfr3l1+kKdy/DIrFQg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394514; 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=TY9UYpkZpqX4mfvmY/RqqrdkZCQ7roAxViM/kJBm9Bg=; b=CB6qvcY+ITkjbMxcqrOhpFFD42/h7RkZ6yxsuxlHXk0syBQsNNVy6OD6VPMEpPYA3efim7koVpXsy+eLBAP/fbktLOAuXrP3G49z+ABCh4qhvL3oH1b8x4ulzXzEAlT/mNJMn3Xu+GYKEpTigyh3yHte8AGJC2NKs+0Yx3UheMc= 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 1584394514626479.0992050651481; Mon, 16 Mar 2020 14:35:14 -0700 (PDT) Received: from localhost ([::1]:49324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxOD-0002vv-7i for importer@patchew.org; Mon, 16 Mar 2020 17:35:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41849) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHH-00031U-Oe for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHG-0002gT-9p for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:03 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:58838) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHG-0002cM-4Q for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-348--kjMsyyvPD-rVqF7rEju1Q-1; Mon, 16 Mar 2020 17:27:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 132321804547; Mon, 16 Mar 2020 21:27:57 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A2E1C19C4F; Mon, 16 Mar 2020 21:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394081; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TY9UYpkZpqX4mfvmY/RqqrdkZCQ7roAxViM/kJBm9Bg=; b=JKxWD8oEGfvJ2LbUI3wX4xMEfyG9lzLu64M7RiJV6rcuKnUOMwV73yOCUgPE8aqPURak+t eJuUXI///LPH+TFm7BuKXpgxaGeufSmFDcF8nQ8CMDcb/CiHh7CzeVx1OiU2F/eG1NgZIX TuI0j5hRAMDURH/CqXtD0JaeBiLo55A= X-MC-Unique: -kjMsyyvPD-rVqF7rEju1Q-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 14/61] configure: Fix building with SASL on Windows Date: Mon, 16 Mar 2020 22:26:41 +0100 Message-Id: <1584394048-44994-15-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Alexey Pavlov , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Biswapriyo Nath Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 The Simple Authentication and Security Layer (SASL) library re-defines the struct iovec on Win32 [*]. QEMU also re-defines it in "qemu/osdep.h". The two definitions then clash on a MinGW build. We can avoid the SASL definition by defining STRUCT_IOVEC_DEFINED. Since QEMU already defines 'struct iovec' if it is missing, add the definition to vnc_sasl_cflags to avoid SASL re-defining it. [*] https://github.com/cyrusimap/cyrus-sasl/blob/cyrus-sasl-2.1.27/include/= sasl.h#L187 Cc: Alexey Pavlov Cc: Biswapriyo Nath Reported-by: Youry Metlitsky Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200309122454.22551-2-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure b/configure index a7f2c3e..44a70cf 100755 --- a/configure +++ b/configure @@ -3367,7 +3367,9 @@ if test "$vnc" =3D "yes" && test "$vnc_sasl" !=3D "no= " ; then int main(void) { sasl_server_init(NULL, "qemu"); return 0; } EOF # Assuming Cyrus-SASL installed in /usr prefix - vnc_sasl_cflags=3D"" + # QEMU defines struct iovec in "qemu/osdep.h", + # we don't want libsasl to redefine it in . + vnc_sasl_cflags=3D"-DSTRUCT_IOVEC_DEFINED" vnc_sasl_libs=3D"-lsasl2" if compile_prog "$vnc_sasl_cflags" "$vnc_sasl_libs" ; then vnc_sasl=3Dyes --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394949; cv=none; d=zohomail.com; s=zohoarc; b=lVuDQbnCkhCsdLsOmK0mQXXGqY5GxbUJKrsrnMWWFcq0TG82LbFg+UAbgo1N9xJzQuYznMdwfLUhcaRhri+eRJtIh9piS7teha+h/3GBQZHRUSWti2fOALO87AHUgaeBB6CIfwhTwAXw2ZbWsVfFcYVI71f4KdFkueiIfKOFVGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394949; 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=IitM4mPKiN40CFCMH52RVRIdZAz8klQZG8CpYOPF4jk=; b=EmjxV9PSa3cGrjKmwg/EkBf8KA93NZ0djKeXhiRz+oOvXsjxqpCskpgJdMEnDsAhNg2ss5utXI5AnkAax1gxInb2cbL6sEwB6NTZTp2AN0J5JrE6KoMwd7wMAfa1Vk1J3iMNrxk8T0VJWQcqq3g4VnlJHMhnn/T1SyhRIJjBpRY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394949548508.93457405737513; Mon, 16 Mar 2020 14:42:29 -0700 (PDT) Received: from localhost ([::1]:49428 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxVE-0005as-H0 for importer@patchew.org; Mon, 16 Mar 2020 17:42:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41903) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHJ-00035M-Ex for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHI-0002tX-8V for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:05 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:32898) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHI-0002rN-1r for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:04 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-RcfB10rANgmUfkVAYFnVbg-1; Mon, 16 Mar 2020 17:28:01 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 393898010C7 for ; Mon, 16 Mar 2020 21:28:00 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9DCDF19C4F; Mon, 16 Mar 2020 21:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394083; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IitM4mPKiN40CFCMH52RVRIdZAz8klQZG8CpYOPF4jk=; b=B5DczBBots0WWZ1Shi7EkoOIUZsJLFbOFeF0YjdGe9xl4NhnUVDX/NrABjNMrjCu7rj3Pm PZvyY11BncJUFj/fZbm6Xeol/BS6h+zTgRDymJC6FMaz5DCY5yjs/fw5MNwzQy/19QqF4/ r2wtWScoiPKSVn74ZCqLb01d48xX5I4= X-MC-Unique: RcfB10rANgmUfkVAYFnVbg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 15/61] tests/docker: Install SASL library to extend code coverage on amd64 Date: Mon, 16 Mar 2020 22:26:42 +0100 Message-Id: <1584394048-44994-16-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Install the SASL library to build the VNC SASL auth protocol code. Reviewed-by: Daniel P. Berrang=C3=A9 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20200309122454.22551-3-philmd@redhat.com> Signed-off-by: Paolo Bonzini --- tests/docker/dockerfiles/debian-amd64.docker | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/docker/dockerfiles/debian-amd64.docker b/tests/docker/do= ckerfiles/debian-amd64.docker index 3b860af..0456fc7 100644 --- a/tests/docker/dockerfiles/debian-amd64.docker +++ b/tests/docker/dockerfiles/debian-amd64.docker @@ -17,6 +17,7 @@ RUN apt update && \ libbz2-dev \ liblzo2-dev \ librdmacm-dev \ + libsasl2-dev \ libsnappy-dev \ libvte-dev =20 --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394960; cv=none; d=zohomail.com; s=zohoarc; b=S4E8SS3Apnxd1W7ME8UMSmDV3+IqCx9A8qnhaitsffDz2QOFB6m2TePJYABDnkKgSx1XQZ66GLEcJX5qt5WljrU2U29oyTBIxYlKxsYpdSPN7WbXiG4NJQ9+HAinIlZyZR5fafGno0ZTc1ZZ8L8wPqEvv/O5tLiMJodUYZ9eI4k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394960; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=5Wh4wBQ+NBmUGn+TfvnBC6WQkHU0SPyP+0/CoeP1DtI=; b=XicighYyKFL9xpzkWBH38uSXW5Nu/Dtz1DKT4j8d6yxnFgrN2RZn/z3POvHDdEomCxqp1rA5MEwQ1mm4KQwu9k9sKjG+y6Y65tfUuKK5Lx9Y9u+FiBhKAY4G8j+BQs24iS+OoY79qCKFOvfQ9G8qYpGAjoEgIO9z0b71ywMqu9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394960054354.2563360666113; Mon, 16 Mar 2020 14:42:40 -0700 (PDT) Received: from localhost ([::1]:49430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxVP-0005hv-2b for importer@patchew.org; Mon, 16 Mar 2020 17:42:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41962) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHL-00039u-M1 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHK-0003A7-GG for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:07 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:57031) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHK-00034y-AA for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:06 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-214-_5Xx59m6PaSG5oQUtEks-Q-1; Mon, 16 Mar 2020 17:28:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B8283149C0; Mon, 16 Mar 2020 21:28:01 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E69119C4F; Mon, 16 Mar 2020 21:28:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394085; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Wh4wBQ+NBmUGn+TfvnBC6WQkHU0SPyP+0/CoeP1DtI=; b=bJdP4CWor3JL44KAII+lE4OvIsFXPQs1acUDPHDmZOtkmwwkrBjIjajQCxDO7EUYeLT1S+ fGLLD5R7gbKIQAc9UwRkTWk+/IAo6N2f08klnkWyFIqWmlB9J8350u/ncvrytrFgXIEulk XDvXZUB6IH5xhE3AG81nOOPWdDmIHgo= X-MC-Unique: _5Xx59m6PaSG5oQUtEks-Q-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 16/61] memory: Fix start offset for bitmap log_clear hook Date: Mon, 16 Mar 2020 22:26:43 +0100 Message-Id: <1584394048-44994-17-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Matt Borgerson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Matt Borgerson Currently only the final page offset is being passed to the `log_clear` hook via `memory_region_clear_dirty_bitmap` after it is used as an iterator in `cpu_physical_memory_test_and_clear_dirty`. This patch corrects the start address and size of the region. Signed-off-by: Matt Borgerson Reviewed-by: Peter Xu Signed-off-by: Paolo Bonzini --- exec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index 0cc500d..de9d949 100644 --- a/exec.c +++ b/exec.c @@ -1315,7 +1315,7 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_add= r_t start, unsigned client) { DirtyMemoryBlocks *blocks; - unsigned long end, page; + unsigned long end, page, start_page; bool dirty =3D false; RAMBlock *ramblock; uint64_t mr_offset, mr_size; @@ -1325,7 +1325,8 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_add= r_t start, } =20 end =3D TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS; - page =3D start >> TARGET_PAGE_BITS; + start_page =3D start >> TARGET_PAGE_BITS; + page =3D start_page; =20 WITH_RCU_READ_LOCK_GUARD() { blocks =3D atomic_rcu_read(&ram_list.dirty_memory[client]); @@ -1345,8 +1346,8 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_add= r_t start, page +=3D num; } =20 - mr_offset =3D (ram_addr_t)(page << TARGET_PAGE_BITS) - ramblock->o= ffset; - mr_size =3D (end - page) << TARGET_PAGE_BITS; + mr_offset =3D (ram_addr_t)(start_page << TARGET_PAGE_BITS) - rambl= ock->offset; + mr_size =3D (end - start_page) << TARGET_PAGE_BITS; memory_region_clear_dirty_bitmap(ramblock->mr, mr_offset, mr_size); } =20 --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395239; cv=none; d=zohomail.com; s=zohoarc; b=g2Tpmk7TvWw3ffGRyZRwqrsJ+xA1l/VU0FyV0PSqtvSaIwnD6nerPSy2MVsMc6We4FOJnpWPReLoHp8vgTsr4AcZXET56rLHvaKF6vOlRTWPkqW7vap7Zmz3vMlgdlW+sA8+dAUcYoyS2yvgWjSxjMKQzAFi2/RQs1TfqwvV+sM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395239; 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=7/R61sTatVz2Lj4MOOjZW3heYwaeufU4381IZAwdn8s=; b=CjOMDnluznCD/EXzjru+wq3waiChcS0Nc7tNOtsUzhsO502KM2Gv5wgmoWUhMzm6wLrh9AJ88IdWRKNUq3hFCp0TM87eDv+TuBMdFca+bjAWCQR1qNKCq9DQVm4QLXqcMMGZeztvBcGMD+IpWBF4cYLtkNj81r4REvbWoNGjzgg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395239202848.5834771328738; Mon, 16 Mar 2020 14:47:19 -0700 (PDT) Received: from localhost ([::1]:49498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxZt-0004fu-Li for importer@patchew.org; Mon, 16 Mar 2020 17:47:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42066) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHQ-0003JR-33 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHN-0003Ry-1T for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:11 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:33591) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHM-0003OK-OO for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:08 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-38-ewirAOkqNOSRrh1goYheIA-1; Mon, 16 Mar 2020 17:28:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23E261005513; Mon, 16 Mar 2020 21:28:03 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D0C919C4F; Mon, 16 Mar 2020 21:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394088; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7/R61sTatVz2Lj4MOOjZW3heYwaeufU4381IZAwdn8s=; b=IVcd7hNXlNXvajk9HPPufuYP0JnLObB5Y6cGZlej1186FPAo7xOBOmsja581NUaSGjQgCv HMnhCf+Thu5URYQgFm2ztYJj24L414xwsPrKTLmjZhJWMDtNckscmzf6SgLerizGzgNGyo GB+TFhhSJ4sZwJl0wLSpUlvb9ETDh8c= X-MC-Unique: ewirAOkqNOSRrh1goYheIA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 17/61] qom/object: enable setter for uint types Date: Mon, 16 Mar 2020 22:26:44 +0100 Message-Id: <1584394048-44994-18-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Felipe Franciosi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Felipe Franciosi Traditionally, the uint-specific property helpers only offer getters. When adding object (or class) uint types, one must therefore use the generic property helper if a setter is needed (and probably duplicate some code writing their own getters/setters). This enhances the uint-specific property helper APIs by adding a bitwise-or'd 'flags' field and modifying all clients of that API to set this paramater to OBJ_PROP_FLAG_READ. This maintains the current behaviour whilst allowing others to also set OBJ_PROP_FLAG_WRITE (or use the more convenient OBJ_PROP_FLAG_READWRITE) in the future (which will automatically install a setter). Other flags may be added later. Signed-off-by: Felipe Franciosi Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- hw/acpi/ich9.c | 4 +- hw/acpi/pcihp.c | 7 +- hw/acpi/piix4.c | 12 +-- hw/isa/lpc_ich9.c | 4 +- hw/ppc/spapr_drc.c | 3 +- include/qom/object.h | 48 ++++++++++-- qom/object.c | 212 +++++++++++++++++++++++++++++++++++++++++++++--= ---- ui/console.c | 4 +- 8 files changed, 246 insertions(+), 48 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 4e74284..67fe05a 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -454,12 +454,12 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMReg= s *pm, Error **errp) pm->s4_val =3D 2; =20 object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE, - &pm->pm_io_base, errp); + &pm->pm_io_base, OBJ_PROP_FLAG_READ, er= rp); object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32", ich9_pm_get_gpe0_blk, NULL, NULL, pm, NULL); object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN, - &gpe0_len, errp); + &gpe0_len, OBJ_PROP_FLAG_READ, errp); object_property_add_bool(obj, "memory-hotplug-support", ich9_pm_get_memory_hotplug_support, ich9_pm_set_memory_hotplug_support, diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c index 8413348..4dcef37 100644 --- a/hw/acpi/pcihp.c +++ b/hw/acpi/pcihp.c @@ -80,7 +80,8 @@ static void *acpi_set_bsel(PCIBus *bus, void *opaque) =20 *bus_bsel =3D (*bsel_alloc)++; object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, - bus_bsel, &error_abort); + bus_bsel, OBJ_PROP_FLAG_READ, + &error_abort); } =20 return bsel_alloc; @@ -373,9 +374,9 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, = PCIBus *root_bus, memory_region_add_subregion(address_space_io, s->io_base, &s->io); =20 object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_= base, - &error_abort); + OBJ_PROP_FLAG_READ, &error_abort); object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_l= en, - &error_abort); + OBJ_PROP_FLAG_READ, &error_abort); } =20 const VMStateDescription vmstate_acpi_pcihp_pci_status =3D { diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c index b84dbba..964d6f5 100644 --- a/hw/acpi/piix4.c +++ b/hw/acpi/piix4.c @@ -444,17 +444,17 @@ static void piix4_pm_add_propeties(PIIX4PMState *s) static const uint16_t sci_int =3D 9; =20 object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_ENABLE_CMD, - &acpi_enable_cmd, NULL); + &acpi_enable_cmd, OBJ_PROP_FLAG_READ, NU= LL); object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_DISABLE_CMD, - &acpi_disable_cmd, NULL); + &acpi_disable_cmd, OBJ_PROP_FLAG_READ, N= ULL); object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK, - &gpe0_blk, NULL); + &gpe0_blk, OBJ_PROP_FLAG_READ, NULL); object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK_LEN, - &gpe0_blk_len, NULL); + &gpe0_blk_len, OBJ_PROP_FLAG_READ, NULL); object_property_add_uint16_ptr(OBJECT(s), ACPI_PM_PROP_SCI_INT, - &sci_int, NULL); + &sci_int, OBJ_PROP_FLAG_READ, NULL); object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_PM_IO_BASE, - &s->io_base, NULL); + &s->io_base, OBJ_PROP_FLAG_READ, NULL); } =20 static void piix4_pm_realize(PCIDevice *dev, Error **errp) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index cb79616..d8186f5 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -643,9 +643,9 @@ static void ich9_lpc_add_properties(ICH9LPCState *lpc) ich9_lpc_get_sci_int, NULL, NULL, NULL, NULL); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CM= D, - &acpi_enable_cmd, NULL); + &acpi_enable_cmd, OBJ_PROP_FLAG_READ, NU= LL); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_C= MD, - &acpi_disable_cmd, NULL); + &acpi_disable_cmd, OBJ_PROP_FLAG_READ, N= ULL); =20 ich9_pm_add_properties(OBJECT(lpc), &lpc->pm, NULL); } diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index e373d34..47e6bb1 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -583,7 +583,8 @@ static void spapr_dr_connector_instance_init(Object *ob= j) SpaprDrc *drc =3D SPAPR_DR_CONNECTOR(obj); SpaprDrcClass *drck =3D SPAPR_DR_CONNECTOR_GET_CLASS(drc); =20 - object_property_add_uint32_ptr(obj, "id", &drc->id, NULL); + object_property_add_uint32_ptr(obj, "id", &drc->id, OBJ_PROP_FLAG_READ, + NULL); object_property_add(obj, "index", "uint32", prop_get_index, NULL, NULL, NULL, NULL); object_property_add(obj, "fdt", "struct", prop_get_fdt, diff --git a/include/qom/object.h b/include/qom/object.h index 2954649..784c97c 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -1664,69 +1664,101 @@ ObjectProperty *object_class_property_add_tm(Objec= tClass *klass, void (*get)(Object *, struct tm *, Error= **), Error **errp); =20 +typedef enum { + /* Automatically add a getter to the property */ + OBJ_PROP_FLAG_READ =3D 1 << 0, + /* Automatically add a setter to the property */ + OBJ_PROP_FLAG_WRITE =3D 1 << 1, + /* Automatically add a getter and a setter to the property */ + OBJ_PROP_FLAG_READWRITE =3D (OBJ_PROP_FLAG_READ | OBJ_PROP_FLAG_WRITE), +} ObjectPropertyFlags; + /** * object_property_add_uint8_ptr: * @obj: the object to add a property to * @name: the name of the property * @v: pointer to value + * @flags: bitwise-or'd ObjectPropertyFlags * @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint8'. */ void object_property_add_uint8_ptr(Object *obj, const char *name, - const uint8_t *v, Error **errp); + const uint8_t *v, ObjectPropertyFlags f= lags, + Error **errp); + ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name, - const uint8_t *v, Error **errp); + const uint8_t *v, + ObjectPropertyFlags flags, + Error **errp); =20 /** * object_property_add_uint16_ptr: * @obj: the object to add a property to * @name: the name of the property * @v: pointer to value + * @flags: bitwise-or'd ObjectPropertyFlags * @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint16'. */ void object_property_add_uint16_ptr(Object *obj, const char *name, - const uint16_t *v, Error **errp); + const uint16_t *v, + ObjectPropertyFlags flags, + Error **errp); + ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name, - const uint16_t *v, Error **errp); + const uint16_t *v, + ObjectPropertyFlags flags, + Error **errp); =20 /** * object_property_add_uint32_ptr: * @obj: the object to add a property to * @name: the name of the property * @v: pointer to value + * @flags: bitwise-or'd ObjectPropertyFlags * @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint32'. */ void object_property_add_uint32_ptr(Object *obj, const char *name, - const uint32_t *v, Error **errp); + const uint32_t *v, + ObjectPropertyFlags flags, + Error **errp); + ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name, - const uint32_t *v, Error **errp); + const uint32_t *v, + ObjectPropertyFlags flags, + Error **errp); =20 /** * object_property_add_uint64_ptr: * @obj: the object to add a property to * @name: the name of the property * @v: pointer to value + * @flags: bitwise-or'd ObjectPropertyFlags * @errp: if an error occurs, a pointer to an area to store the error * * Add an integer property in memory. This function will add a * property of type 'uint64'. */ void object_property_add_uint64_ptr(Object *obj, const char *name, - const uint64_t *v, Error **errp); + const uint64_t *v, + ObjectPropertyFlags flags, + Error **Errp); + ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass, const char *name, - const uint64_t *v, Error **errp); + const uint64_t *v, + ObjectPropertyFlags flags, + Error **Errp); =20 /** * object_property_add_alias: diff --git a/qom/object.c b/qom/object.c index 555c8b9..1812f79 100644 --- a/qom/object.c +++ b/qom/object.c @@ -2498,6 +2498,22 @@ static void property_get_uint8_ptr(Object *obj, Visi= tor *v, const char *name, visit_type_uint8(v, name, &value, errp); } =20 +static void property_set_uint8_ptr(Object *obj, Visitor *v, const char *na= me, + void *opaque, Error **errp) +{ + uint8_t *field =3D opaque; + uint8_t value; + Error *local_err =3D NULL; + + visit_type_uint8(v, name, &value, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + *field =3D value; +} + static void property_get_uint16_ptr(Object *obj, Visitor *v, const char *n= ame, void *opaque, Error **errp) { @@ -2505,6 +2521,22 @@ static void property_get_uint16_ptr(Object *obj, Vis= itor *v, const char *name, visit_type_uint16(v, name, &value, errp); } =20 +static void property_set_uint16_ptr(Object *obj, Visitor *v, const char *n= ame, + void *opaque, Error **errp) +{ + uint16_t *field =3D opaque; + uint16_t value; + Error *local_err =3D NULL; + + visit_type_uint16(v, name, &value, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + *field =3D value; +} + static void property_get_uint32_ptr(Object *obj, Visitor *v, const char *n= ame, void *opaque, Error **errp) { @@ -2512,6 +2544,22 @@ static void property_get_uint32_ptr(Object *obj, Vis= itor *v, const char *name, visit_type_uint32(v, name, &value, errp); } =20 +static void property_set_uint32_ptr(Object *obj, Visitor *v, const char *n= ame, + void *opaque, Error **errp) +{ + uint32_t *field =3D opaque; + uint32_t value; + Error *local_err =3D NULL; + + visit_type_uint32(v, name, &value, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + *field =3D value; +} + static void property_get_uint64_ptr(Object *obj, Visitor *v, const char *n= ame, void *opaque, Error **errp) { @@ -2519,68 +2567,184 @@ static void property_get_uint64_ptr(Object *obj, V= isitor *v, const char *name, visit_type_uint64(v, name, &value, errp); } =20 +static void property_set_uint64_ptr(Object *obj, Visitor *v, const char *n= ame, + void *opaque, Error **errp) +{ + uint64_t *field =3D opaque; + uint64_t value; + Error *local_err =3D NULL; + + visit_type_uint64(v, name, &value, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } + + *field =3D value; +} + void object_property_add_uint8_ptr(Object *obj, const char *name, - const uint8_t *v, Error **errp) + const uint8_t *v, + ObjectPropertyFlags flags, + Error **errp) { - object_property_add(obj, name, "uint8", property_get_uint8_ptr, - NULL, NULL, (void *)v, errp); + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint8_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint8_ptr; + } + + object_property_add(obj, name, "uint8", + getter, setter, NULL, (void *)v, errp); } =20 ObjectProperty * object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name, - const uint8_t *v, Error **errp) + const uint8_t *v, + ObjectPropertyFlags flags, + Error **errp) { + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint8_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint8_ptr; + } + return object_class_property_add(klass, name, "uint8", - property_get_uint8_ptr, - NULL, NULL, (void *)v, errp); + getter, setter, NULL, (void *)v, errp= ); } =20 void object_property_add_uint16_ptr(Object *obj, const char *name, - const uint16_t *v, Error **errp) + const uint16_t *v, + ObjectPropertyFlags flags, + Error **errp) { - object_property_add(obj, name, "uint16", property_get_uint16_ptr, - NULL, NULL, (void *)v, errp); + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint16_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint16_ptr; + } + + object_property_add(obj, name, "uint16", + getter, setter, NULL, (void *)v, errp); } =20 ObjectProperty * object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name, - const uint16_t *v, Error **errp) + const uint16_t *v, + ObjectPropertyFlags flags, + Error **errp) { + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint16_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint16_ptr; + } + return object_class_property_add(klass, name, "uint16", - property_get_uint16_ptr, - NULL, NULL, (void *)v, errp); + getter, setter, NULL, (void *)v, errp= ); } =20 void object_property_add_uint32_ptr(Object *obj, const char *name, - const uint32_t *v, Error **errp) + const uint32_t *v, + ObjectPropertyFlags flags, + Error **errp) { - object_property_add(obj, name, "uint32", property_get_uint32_ptr, - NULL, NULL, (void *)v, errp); + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint32_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint32_ptr; + } + + object_property_add(obj, name, "uint32", + getter, setter, NULL, (void *)v, errp); } =20 ObjectProperty * object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name, - const uint32_t *v, Error **errp) + const uint32_t *v, + ObjectPropertyFlags flags, + Error **errp) { + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint32_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint32_ptr; + } + return object_class_property_add(klass, name, "uint32", - property_get_uint32_ptr, - NULL, NULL, (void *)v, errp); + getter, setter, NULL, (void *)v, errp= ); } =20 void object_property_add_uint64_ptr(Object *obj, const char *name, - const uint64_t *v, Error **errp) + const uint64_t *v, + ObjectPropertyFlags flags, + Error **errp) { - object_property_add(obj, name, "uint64", property_get_uint64_ptr, - NULL, NULL, (void *)v, errp); + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint64_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint64_ptr; + } + + object_property_add(obj, name, "uint64", + getter, setter, NULL, (void *)v, errp); } =20 ObjectProperty * object_class_property_add_uint64_ptr(ObjectClass *klass, const char *name, - const uint64_t *v, Error **errp) + const uint64_t *v, + ObjectPropertyFlags flags, + Error **errp) { + ObjectPropertyAccessor *getter =3D NULL; + ObjectPropertyAccessor *setter =3D NULL; + + if ((flags & OBJ_PROP_FLAG_READ) =3D=3D OBJ_PROP_FLAG_READ) { + getter =3D property_get_uint64_ptr; + } + + if ((flags & OBJ_PROP_FLAG_WRITE) =3D=3D OBJ_PROP_FLAG_WRITE) { + setter =3D property_set_uint64_ptr; + } + return object_class_property_add(klass, name, "uint64", - property_get_uint64_ptr, - NULL, NULL, (void *)v, errp); + getter, setter, NULL, (void *)v, errp= ); } =20 typedef struct { diff --git a/ui/console.c b/ui/console.c index 179901c..184e173 100644 --- a/ui/console.c +++ b/ui/console.c @@ -1299,8 +1299,8 @@ static QemuConsole *new_console(DisplayState *ds, con= sole_type_t console_type, object_property_allow_set_link, OBJ_PROP_LINK_STRONG, &error_abort); - object_property_add_uint32_ptr(obj, "head", - &s->head, &error_abort); + object_property_add_uint32_ptr(obj, "head", &s->head, + OBJ_PROP_FLAG_READ, &error_abort); =20 if (!active_console || ((active_console->console_type !=3D GRAPHIC_CON= SOLE) && (console_type =3D=3D GRAPHIC_CONSOLE))) { --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395058; cv=none; d=zohomail.com; s=zohoarc; b=bcWuxmi2BPdB7KJyhD1Bx4N+hxnQ9ilvxjjWZB4B+8LwIf3w36ErW4rK1vRMca/UiCsz2mzbCiv1n7/l+jHiUjLvKcaJZV+LdUX19hvD9jV18bV9eovLippTzsLWPO4y60Bx40arg/XYJCKw5qXCLcHM9umaxSqvyCpT8WjF2bM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395058; 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=xs/xoP908nTLjxtzoFLOSupK1gag++XJXC66ml7AKow=; b=h7igUQ1xJJNeYCYyyyWpWoVbtnbKZKQC6vVF9ZV0fuEt08eNd8Atty/GJkeykyJpx6z8EXV/GAGXaEWEvGyAc7VRJYLGytcZqbV1pxaYyAQfSDj4G1omPWkGY1d3BSa8CmOXWdtBe/k2UNhKi+0lKajv+wbCuWwIxa3dLxzsNjQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 158439505888878.70212555597595; Mon, 16 Mar 2020 14:44:18 -0700 (PDT) Received: from localhost ([::1]:49454 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxWz-00011Y-PU for importer@patchew.org; Mon, 16 Mar 2020 17:44:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42056) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHP-0003IN-Jz for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHO-0003aj-CN for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:11 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:30215) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHO-0003Xw-45 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:10 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-ffQIO9LgOb207rTS0i6pqQ-1; Mon, 16 Mar 2020 17:28:05 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 776B7801E66; Mon, 16 Mar 2020 21:28:04 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8151A19C4F; Mon, 16 Mar 2020 21:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xs/xoP908nTLjxtzoFLOSupK1gag++XJXC66ml7AKow=; b=Ou0A0VNOo+g51/ZOMWgjlZJ9H2+070KAH9IZrNiu/wD3zFM1nZWqtGY2Woj7sokTtb74bu QpAgd2+tSakxn+MCMdz++jncvvOElup5lWJYOwQUEop2IyYJvceMX2fqoryos9fZEQgUS0 P2G+Hc5U1SgJwZdwNkODCdrrE5ORRak= X-MC-Unique: ffQIO9LgOb207rTS0i6pqQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 18/61] ich9: fix getter type for sci_int property Date: Mon, 16 Mar 2020 22:26:45 +0100 Message-Id: <1584394048-44994-19-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Felipe Franciosi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Felipe Franciosi When QOM APIs were added to ich9 in 6f1426ab, the getter for sci_int was written using uint32_t. However, the object property is uint8_t. This fixes the getter for correctness. Signed-off-by: Felipe Franciosi Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- hw/isa/lpc_ich9.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index d8186f5..2471463 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -629,9 +629,7 @@ static void ich9_lpc_get_sci_int(Object *obj, Visitor *= v, const char *name, void *opaque, Error **errp) { ICH9LPCState *lpc =3D ICH9_LPC_DEVICE(obj); - uint32_t value =3D lpc->sci_gsi; - - visit_type_uint32(v, name, &value, errp); + visit_type_uint8(v, name, &lpc->sci_gsi, errp); } =20 static void ich9_lpc_add_properties(ICH9LPCState *lpc) @@ -639,7 +637,7 @@ static void ich9_lpc_add_properties(ICH9LPCState *lpc) static const uint8_t acpi_enable_cmd =3D ICH9_APM_ACPI_ENABLE; static const uint8_t acpi_disable_cmd =3D ICH9_APM_ACPI_DISABLE; =20 - object_property_add(OBJECT(lpc), ACPI_PM_PROP_SCI_INT, "uint32", + object_property_add(OBJECT(lpc), ACPI_PM_PROP_SCI_INT, "uint8", ich9_lpc_get_sci_int, NULL, NULL, NULL, NULL); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CM= D, --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394652; cv=none; d=zohomail.com; s=zohoarc; b=Dykpj9vf0/I6wn9e9EoiquQUOL83g5frtvo79OjT95uYnXb4MDRG/dDSR7QxUdV7RYY2+X1WI9iSEKjt3k/bR6zT9nmGY693gHeg9CS9jIn/S6Lx9dA5LxgR0W20uuE3RCTyR3VAfcRZzxUkkoxinH6hGmjmNtkTOWPkM7JvM9s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394652; 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=fOhOQTXfi9/u88BP9ZPEQTKPFP6i3gc1TE6yZVu0S7I=; b=DtpbIFSUMnMnv00xw9ETvopWmy4BoJzBHIbP3pYixWkaJ6movGOj1NAbgUu0a5ayRx31HwYyamDmUaqUG+hjmJ/qy8DD2FZHDEQWVzZwBxpZwWGwiRBnToikEpkJS2X982IpFMl1WAfmVkOS7oPwoZR6KVWk5kkBaO+I0hc89xA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394652334894.3562576927093; Mon, 16 Mar 2020 14:37:32 -0700 (PDT) Received: from localhost ([::1]:49360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxQR-0006O9-6z for importer@patchew.org; Mon, 16 Mar 2020 17:37:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42041) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHP-0003HI-3K for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHN-0003Wr-ON for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:10 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:32733) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHN-0003Tc-HU for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:09 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-158-J8hMuY60PPKYJiDOEYTrfA-1; Mon, 16 Mar 2020 17:28:06 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D27AE800D50; Mon, 16 Mar 2020 21:28:05 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFC4E19C4F; Mon, 16 Mar 2020 21:28:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fOhOQTXfi9/u88BP9ZPEQTKPFP6i3gc1TE6yZVu0S7I=; b=TrqgPnJwuWNg7+gGe0q3cmjZG53lc9A0RLgyBjtXW3G+sKSrXZ7xEqErDeRjwRfPnHzHfN T//T2lAA5moZC/XUZVoYLllwDTRxspLDXz4WBIoiDjEXt6rMchkq7EhGZHmweVlCJEDwXW ebzN2tr05XuqULnl+RvrE2L054wfk2M= X-MC-Unique: J8hMuY60PPKYJiDOEYTrfA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 19/61] ich9: Simplify ich9_lpc_initfn Date: Mon, 16 Mar 2020 22:26:46 +0100 Message-Id: <1584394048-44994-20-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Felipe Franciosi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Felipe Franciosi Currently, ich9_lpc_initfn simply serves as a caller to ich9_lpc_add_properties. This simplifies the code a bit by eliminating ich9_lpc_add_properties altogether and executing its logic in the parent object initialiser function. Signed-off-by: Felipe Franciosi Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- hw/isa/lpc_ich9.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 2471463..3d0f4db 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -632,12 +632,14 @@ static void ich9_lpc_get_sci_int(Object *obj, Visitor= *v, const char *name, visit_type_uint8(v, name, &lpc->sci_gsi, errp); } =20 -static void ich9_lpc_add_properties(ICH9LPCState *lpc) +static void ich9_lpc_initfn(Object *obj) { + ICH9LPCState *lpc =3D ICH9_LPC_DEVICE(obj); + static const uint8_t acpi_enable_cmd =3D ICH9_APM_ACPI_ENABLE; static const uint8_t acpi_disable_cmd =3D ICH9_APM_ACPI_DISABLE; =20 - object_property_add(OBJECT(lpc), ACPI_PM_PROP_SCI_INT, "uint8", + object_property_add(obj, ACPI_PM_PROP_SCI_INT, "uint8", ich9_lpc_get_sci_int, NULL, NULL, NULL, NULL); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CM= D, @@ -645,14 +647,7 @@ static void ich9_lpc_add_properties(ICH9LPCState *lpc) object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_C= MD, &acpi_disable_cmd, OBJ_PROP_FLAG_READ, N= ULL); =20 - ich9_pm_add_properties(OBJECT(lpc), &lpc->pm, NULL); -} - -static void ich9_lpc_initfn(Object *obj) -{ - ICH9LPCState *lpc =3D ICH9_LPC_DEVICE(obj); - - ich9_lpc_add_properties(lpc); + ich9_pm_add_properties(obj, &lpc->pm, NULL); } =20 static void ich9_lpc_realize(PCIDevice *d, Error **errp) --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394759; cv=none; d=zohomail.com; s=zohoarc; b=ee9ezdCiGdk/RPTcCVwi9Fi8lasqgCEdbgErfeGA/RwxHUkEsnB1t9ec7m//4Qpb4GXBInp1jN/fCYKPrH71SOFxKjuRdhD77eGCXMNgO7f3HpjGOBKbnl8Is1KpkNaEs0ZC8j827u44pfC/3w/rtdmIfYBLyfMaCQgIMEPtUOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394759; 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=mL+UrM7rBopI4N44idY+Y3FyvYTN9D88OpzfXEmVZpE=; b=MCuaiPuxcFJPfrLIPi64iQU2nlYC00iSfMPMi7fKeIOuHN37Rvhe1sT/k6SNW38H2w/13FoyGGK3CHmRd6vLVOHd2gI/LLBvpHFOLgp/ARFDbbY6L2q8vhoXrftX5HK9gCsBWZgIevVHwS76Pp80RiNAPPFd4iutzVz2E5DFuxo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394759663455.37815914871055; Mon, 16 Mar 2020 14:39:19 -0700 (PDT) Received: from localhost ([::1]:49386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxSA-0000N1-9v for importer@patchew.org; Mon, 16 Mar 2020 17:39:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42128) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHS-0003P8-Ni for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHP-0003gI-9k for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:14 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:50329) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHP-0003cV-01 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:11 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-235-N-PWMI-WMKGXneT-3PJnUQ-1; Mon, 16 Mar 2020 17:28:08 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E52D1804544; Mon, 16 Mar 2020 21:28:07 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 497BC19C4F; Mon, 16 Mar 2020 21:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394090; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mL+UrM7rBopI4N44idY+Y3FyvYTN9D88OpzfXEmVZpE=; b=Vqfd1zB8te04AzFgNs+2gLLIUwA7j3hBK/T8iT3IyrQTaeWfEUL25Krk9wljjGoTEORgqt 99unJOuuLhxC++sGiKvu70W2WNCcZjymNg8tg6nsBPBMloEuCxqDBvNU4qBWi23EQ3QIFe IoitEfO9a+7hu9UbUgXq8hXvh2EmgCE= X-MC-Unique: N-PWMI-WMKGXneT-3PJnUQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 20/61] qom/object: Use common get/set uint helpers Date: Mon, 16 Mar 2020 22:26:47 +0100 Message-Id: <1584394048-44994-21-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Felipe Franciosi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Felipe Franciosi Several objects implemented their own uint property getters and setters, despite them being straightforward (without any checks/validations on the values themselves) and identical across objects. This makes use of an enhanced API for object_property_add_uintXX_ptr() which offers default setters. Some of these setters used to update the value even if the type visit failed (eg. because the value being set overflowed over the given type). The new setter introduces a check for these errors, not updating the value if an error occurred. The error is propagated. Signed-off-by: Felipe Franciosi Reviewed-by: Marc-Andr=C3=A9 Lureau Signed-off-by: Paolo Bonzini --- hw/acpi/ich9.c | 95 +++++------------------------------------------- hw/isa/lpc_ich9.c | 12 ++----- hw/misc/edu.c | 13 ++----- hw/pci-host/q35.c | 14 ++------ hw/ppc/spapr.c | 36 ++++--------------- memory.c | 15 ++------ target/arm/cpu.c | 22 ++---------- target/i386/sev.c | 106 +++++---------------------------------------------= ---- 8 files changed, 37 insertions(+), 276 deletions(-) diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c index 67fe05a..336cace 100644 --- a/hw/acpi/ich9.c +++ b/hw/acpi/ich9.c @@ -357,81 +357,6 @@ static void ich9_pm_set_cpu_hotplug_legacy(Object *obj= , bool value, s->pm.cpu_hotplug_legacy =3D value; } =20 -static void ich9_pm_get_disable_s3(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) -{ - ICH9LPCPMRegs *pm =3D opaque; - uint8_t value =3D pm->disable_s3; - - visit_type_uint8(v, name, &value, errp); -} - -static void ich9_pm_set_disable_s3(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) -{ - ICH9LPCPMRegs *pm =3D opaque; - Error *local_err =3D NULL; - uint8_t value; - - visit_type_uint8(v, name, &value, &local_err); - if (local_err) { - goto out; - } - pm->disable_s3 =3D value; -out: - error_propagate(errp, local_err); -} - -static void ich9_pm_get_disable_s4(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) -{ - ICH9LPCPMRegs *pm =3D opaque; - uint8_t value =3D pm->disable_s4; - - visit_type_uint8(v, name, &value, errp); -} - -static void ich9_pm_set_disable_s4(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) -{ - ICH9LPCPMRegs *pm =3D opaque; - Error *local_err =3D NULL; - uint8_t value; - - visit_type_uint8(v, name, &value, &local_err); - if (local_err) { - goto out; - } - pm->disable_s4 =3D value; -out: - error_propagate(errp, local_err); -} - -static void ich9_pm_get_s4_val(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ICH9LPCPMRegs *pm =3D opaque; - uint8_t value =3D pm->s4_val; - - visit_type_uint8(v, name, &value, errp); -} - -static void ich9_pm_set_s4_val(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ICH9LPCPMRegs *pm =3D opaque; - Error *local_err =3D NULL; - uint8_t value; - - visit_type_uint8(v, name, &value, &local_err); - if (local_err) { - goto out; - } - pm->s4_val =3D value; -out: - error_propagate(errp, local_err); -} - static bool ich9_pm_get_enable_tco(Object *obj, Error **errp) { ICH9LPCState *s =3D ICH9_LPC_DEVICE(obj); @@ -468,18 +393,14 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMReg= s *pm, Error **errp) ich9_pm_get_cpu_hotplug_legacy, ich9_pm_set_cpu_hotplug_legacy, NULL); - object_property_add(obj, ACPI_PM_PROP_S3_DISABLED, "uint8", - ich9_pm_get_disable_s3, - ich9_pm_set_disable_s3, - NULL, pm, NULL); - object_property_add(obj, ACPI_PM_PROP_S4_DISABLED, "uint8", - ich9_pm_get_disable_s4, - ich9_pm_set_disable_s4, - NULL, pm, NULL); - object_property_add(obj, ACPI_PM_PROP_S4_VAL, "uint8", - ich9_pm_get_s4_val, - ich9_pm_set_s4_val, - NULL, pm, NULL); + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S3_DISABLED, + &pm->disable_s3, OBJ_PROP_FLAG_READWRITE, + NULL); + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S4_DISABLED, + &pm->disable_s4, OBJ_PROP_FLAG_READWRITE, + NULL); + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S4_VAL, + &pm->s4_val, OBJ_PROP_FLAG_READWRITE, NU= LL); object_property_add_bool(obj, ACPI_PM_PROP_TCO_ENABLED, ich9_pm_get_enable_tco, ich9_pm_set_enable_tco, diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index 3d0f4db..fbc3165 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -625,13 +625,6 @@ static const MemoryRegionOps ich9_rst_cnt_ops =3D { .endianness =3D DEVICE_LITTLE_ENDIAN }; =20 -static void ich9_lpc_get_sci_int(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ICH9LPCState *lpc =3D ICH9_LPC_DEVICE(obj); - visit_type_uint8(v, name, &lpc->sci_gsi, errp); -} - static void ich9_lpc_initfn(Object *obj) { ICH9LPCState *lpc =3D ICH9_LPC_DEVICE(obj); @@ -639,9 +632,8 @@ static void ich9_lpc_initfn(Object *obj) static const uint8_t acpi_enable_cmd =3D ICH9_APM_ACPI_ENABLE; static const uint8_t acpi_disable_cmd =3D ICH9_APM_ACPI_DISABLE; =20 - object_property_add(obj, ACPI_PM_PROP_SCI_INT, "uint8", - ich9_lpc_get_sci_int, - NULL, NULL, NULL, NULL); + object_property_add_uint8_ptr(obj, ACPI_PM_PROP_SCI_INT, + &lpc->sci_gsi, OBJ_PROP_FLAG_READ, NULL); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CM= D, &acpi_enable_cmd, OBJ_PROP_FLAG_READ, NU= LL); object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_C= MD, diff --git a/hw/misc/edu.c b/hw/misc/edu.c index d5e2bdb..ff10f5b 100644 --- a/hw/misc/edu.c +++ b/hw/misc/edu.c @@ -396,21 +396,14 @@ static void pci_edu_uninit(PCIDevice *pdev) msi_uninit(pdev); } =20 -static void edu_obj_uint64(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - uint64_t *val =3D opaque; - - visit_type_uint64(v, name, val, errp); -} - static void edu_instance_init(Object *obj) { EduState *edu =3D EDU(obj); =20 edu->dma_mask =3D (1UL << 28) - 1; - object_property_add(obj, "dma_mask", "uint64", edu_obj_uint64, - edu_obj_uint64, NULL, &edu->dma_mask, NULL); + object_property_add_uint64_ptr(obj, "dma_mask", + &edu->dma_mask, OBJ_PROP_FLAG_READWRITE, + NULL); } =20 static void edu_class_init(ObjectClass *class, void *data) diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index 993f467..2bbc90b 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -166,14 +166,6 @@ static void q35_host_get_pci_hole64_end(Object *obj, V= isitor *v, visit_type_uint64(v, name, &value, errp); } =20 -static void q35_host_get_mmcfg_size(Object *obj, Visitor *v, const char *n= ame, - void *opaque, Error **errp) -{ - PCIExpressHost *e =3D PCIE_HOST_BRIDGE(obj); - - visit_type_uint64(v, name, &e->size, errp); -} - /* * NOTE: setting defaults for the mch.* fields in this table * doesn't work, because mch is a separate QOM object that is @@ -214,6 +206,7 @@ static void q35_host_initfn(Object *obj) { Q35PCIHost *s =3D Q35_HOST_DEVICE(obj); PCIHostState *phb =3D PCI_HOST_BRIDGE(obj); + PCIExpressHost *pehb =3D PCIE_HOST_BRIDGE(obj); =20 memory_region_init_io(&phb->conf_mem, obj, &pci_host_conf_le_ops, phb, "pci-conf-idx", 4); @@ -243,9 +236,8 @@ static void q35_host_initfn(Object *obj) q35_host_get_pci_hole64_end, NULL, NULL, NULL, NULL); =20 - object_property_add(obj, PCIE_HOST_MCFG_SIZE, "uint64", - q35_host_get_mmcfg_size, - NULL, NULL, NULL, NULL); + object_property_add_uint64_ptr(obj, PCIE_HOST_MCFG_SIZE, + &pehb->size, OBJ_PROP_FLAG_READ, NULL); =20 object_property_add_link(obj, MCH_HOST_PROP_RAM_MEM, TYPE_MEMORY_REGIO= N, (Object **) &s->mch.ram_memory, diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index cc10798..41c0f24 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -3223,30 +3223,6 @@ static void spapr_set_resize_hpt(Object *obj, const = char *value, Error **errp) } } =20 -static void spapr_get_vsmt(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - visit_type_uint32(v, name, (uint32_t *)opaque, errp); -} - -static void spapr_set_vsmt(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - visit_type_uint32(v, name, (uint32_t *)opaque, errp); -} - -static void spapr_get_kernel_addr(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) -{ - visit_type_uint64(v, name, (uint64_t *)opaque, errp); -} - -static void spapr_set_kernel_addr(Object *obj, Visitor *v, const char *nam= e, - void *opaque, Error **errp) -{ - visit_type_uint64(v, name, (uint64_t *)opaque, errp); -} - static char *spapr_get_ic_mode(Object *obj, Error **errp) { SpaprMachineState *spapr =3D SPAPR_MACHINE(obj); @@ -3344,17 +3320,19 @@ static void spapr_instance_init(Object *obj) object_property_set_description(obj, "resize-hpt", "Resizing of the Hash Page Table (enab= led, disabled, required)", NULL); - object_property_add(obj, "vsmt", "uint32", spapr_get_vsmt, - spapr_set_vsmt, NULL, &spapr->vsmt, &error_abort); + object_property_add_uint32_ptr(obj, "vsmt", + &spapr->vsmt, OBJ_PROP_FLAG_READWRITE, + &error_abort); object_property_set_description(obj, "vsmt", "Virtual SMT: KVM behaves as if this w= ere" " the host's SMT mode", &error_abort); + object_property_add_bool(obj, "vfio-no-msix-emulation", spapr_get_msix_emulation, NULL, NULL); =20 - object_property_add(obj, "kernel-addr", "uint64", spapr_get_kernel_add= r, - spapr_set_kernel_addr, NULL, &spapr->kernel_addr, - &error_abort); + object_property_add_uint64_ptr(obj, "kernel-addr", + &spapr->kernel_addr, OBJ_PROP_FLAG_READ= WRITE, + &error_abort); object_property_set_description(obj, "kernel-addr", stringify(KERNEL_LOAD_ADDR) " for -kernel is the default", diff --git a/memory.c b/memory.c index 09be40e..404ff4e 100644 --- a/memory.c +++ b/memory.c @@ -1170,15 +1170,6 @@ void memory_region_init(MemoryRegion *mr, memory_region_do_init(mr, owner, name, size); } =20 -static void memory_region_get_addr(Object *obj, Visitor *v, const char *na= me, - void *opaque, Error **errp) -{ - MemoryRegion *mr =3D MEMORY_REGION(obj); - uint64_t value =3D mr->addr; - - visit_type_uint64(v, name, &value, errp); -} - static void memory_region_get_container(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -1242,10 +1233,8 @@ static void memory_region_initfn(Object *obj) NULL, NULL, &error_abort); op->resolve =3D memory_region_resolve_container; =20 - object_property_add(OBJECT(mr), "addr", "uint64", - memory_region_get_addr, - NULL, /* memory_region_set_addr */ - NULL, NULL, &error_abort); + object_property_add_uint64_ptr(OBJECT(mr), "addr", + &mr->addr, OBJ_PROP_FLAG_READ, &error_a= bort); object_property_add(OBJECT(mr), "priority", "uint32", memory_region_get_priority, NULL, /* memory_region_set_priority */ diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 3623ece..7fe3670 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1153,22 +1153,6 @@ static void arm_set_pmu(Object *obj, bool value, Err= or **errp) cpu->has_pmu =3D value; } =20 -static void arm_get_init_svtor(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ARMCPU *cpu =3D ARM_CPU(obj); - - visit_type_uint32(v, name, &cpu->init_svtor, errp); -} - -static void arm_set_init_svtor(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - ARMCPU *cpu =3D ARM_CPU(obj); - - visit_type_uint32(v, name, &cpu->init_svtor, errp); -} - unsigned int gt_cntfrq_period_ns(ARMCPU *cpu) { /* @@ -1288,9 +1272,9 @@ void arm_cpu_post_init(Object *obj) * a simple DEFINE_PROP_UINT32 for this because we want to permit * the property to be set after realize. */ - object_property_add(obj, "init-svtor", "uint32", - arm_get_init_svtor, arm_set_init_svtor, - NULL, NULL, &error_abort); + object_property_add_uint32_ptr(obj, "init-svtor", + &cpu->init_svtor, + OBJ_PROP_FLAG_READWRITE, &error_abo= rt); } =20 qdev_property_add_static(DEVICE(obj), &arm_cpu_cfgend_property); diff --git a/target/i386/sev.c b/target/i386/sev.c index 024bb24..846018a 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -267,109 +267,21 @@ qsev_guest_class_init(ObjectClass *oc, void *data) } =20 static void -qsev_guest_set_handle(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - uint32_t value; - - visit_type_uint32(v, name, &value, errp); - sev->handle =3D value; -} - -static void -qsev_guest_set_policy(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - uint32_t value; - - visit_type_uint32(v, name, &value, errp); - sev->policy =3D value; -} - -static void -qsev_guest_set_cbitpos(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - uint32_t value; - - visit_type_uint32(v, name, &value, errp); - sev->cbitpos =3D value; -} - -static void -qsev_guest_set_reduced_phys_bits(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - uint32_t value; - - visit_type_uint32(v, name, &value, errp); - sev->reduced_phys_bits =3D value; -} - -static void -qsev_guest_get_policy(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - uint32_t value; - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - - value =3D sev->policy; - visit_type_uint32(v, name, &value, errp); -} - -static void -qsev_guest_get_handle(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - uint32_t value; - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - - value =3D sev->handle; - visit_type_uint32(v, name, &value, errp); -} - -static void -qsev_guest_get_cbitpos(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - uint32_t value; - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - - value =3D sev->cbitpos; - visit_type_uint32(v, name, &value, errp); -} - -static void -qsev_guest_get_reduced_phys_bits(Object *obj, Visitor *v, const char *name, - void *opaque, Error **errp) -{ - uint32_t value; - QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); - - value =3D sev->reduced_phys_bits; - visit_type_uint32(v, name, &value, errp); -} - -static void qsev_guest_init(Object *obj) { QSevGuestInfo *sev =3D QSEV_GUEST_INFO(obj); =20 sev->sev_device =3D g_strdup(DEFAULT_SEV_DEVICE); sev->policy =3D DEFAULT_GUEST_POLICY; - object_property_add(obj, "policy", "uint32", qsev_guest_get_policy, - qsev_guest_set_policy, NULL, NULL, NULL); - object_property_add(obj, "handle", "uint32", qsev_guest_get_handle, - qsev_guest_set_handle, NULL, NULL, NULL); - object_property_add(obj, "cbitpos", "uint32", qsev_guest_get_cbitpos, - qsev_guest_set_cbitpos, NULL, NULL, NULL); - object_property_add(obj, "reduced-phys-bits", "uint32", - qsev_guest_get_reduced_phys_bits, - qsev_guest_set_reduced_phys_bits, NULL, NULL, NULL= ); + object_property_add_uint32_ptr(obj, "policy", &sev->policy, + OBJ_PROP_FLAG_READWRITE, NULL); + object_property_add_uint32_ptr(obj, "handle", &sev->handle, + OBJ_PROP_FLAG_READWRITE, NULL); + object_property_add_uint32_ptr(obj, "cbitpos", &sev->cbitpos, + OBJ_PROP_FLAG_READWRITE, NULL); + object_property_add_uint32_ptr(obj, "reduced-phys-bits", + &sev->reduced_phys_bits, + OBJ_PROP_FLAG_READWRITE, NULL); } =20 /* sev guest info */ --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394611; cv=none; d=zohomail.com; s=zohoarc; b=f22mMBvhJzhVfRltsSPXQH/wcWnIJ66OyVW5dJd4qKCsNzaugn0urWcBJEvwEMncBzuf56kO6pgdU8c7gIVptAFsfacDOSetn0a9VhZUFtJm8LNVY7+DVnR0PjBHJVG8UxZZ6oyRFkU9hMnC2ffnqkQB2vofo7YIcGtmQu6RBGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394611; 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=iK3jlJnz8NlA8NS0Z2nedDU+tQW241PC1gri39nFTGE=; b=WiGjL3o4GnK+V8BY8jOM6Ez/ZQg6dLDd6r0xyQGhRIF8hxDdApWsW1gWhLcy7zAUwzQJaMfrK2htZpSPy6m01BkPYdkGfaRNsyPaE3KxtO26hd0dIu6N5X6WtFvV+CZJr0/0wptmF4gGdXym/FwU7hCr5lqWPdeg+LqHjNWo0aE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394611047425.6061160714363; Mon, 16 Mar 2020 14:36:51 -0700 (PDT) Received: from localhost ([::1]:49358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxPl-00055Q-VW for importer@patchew.org; Mon, 16 Mar 2020 17:36:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42124) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHS-0003On-JX for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHQ-0003nM-O4 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:14 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:39114) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHQ-0003kq-EA for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:12 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-307-9Xnr5G9APWuw-SMByjvGTg-1; Mon, 16 Mar 2020 17:28:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9F240800D50; Mon, 16 Mar 2020 21:28:08 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A8A2E19C4F; Mon, 16 Mar 2020 21:28:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394092; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iK3jlJnz8NlA8NS0Z2nedDU+tQW241PC1gri39nFTGE=; b=TfnH1kYEvByqRxZln/t4Z6yYz0oKRB4MzQvoaBKXXU4CJw+dGotEmH2wizhh/UiR98Y/cV QSzuo67T2rhKgNBjSV1uwT5n8tbjct9bxYyhhk/ygHFrFUIvmocyi4hTusvqF/t3D1S52V CRPQ7uJnOh86+fsRbYBjUa0uICHItiE= X-MC-Unique: 9Xnr5G9APWuw-SMByjvGTg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 21/61] i386: Fix GCC warning with snprintf when HAX is enabled Date: Mon, 16 Mar 2020 22:26:48 +0100 Message-Id: <1584394048-44994-22-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Julio Faracco Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Julio Faracco When HAX is enabled (--enable-hax), GCC 9.2.1 reports issues with snprintf(). Replacing old snprintf() by g_strdup_printf() fixes the problem with boundary checks of vm_id and vcpu_id and finally the warnings produced by GCC. For more details, one example of warning: CC i386-softmmu/target/i386/hax-posix.o qemu/target/i386/hax-posix.c: In function =E2=80=98hax_host_open_vm=E2=80= =99: qemu/target/i386/hax-posix.c:124:56: error: =E2=80=98%02d=E2=80=99 directiv= e output may be truncated writing between 2 and 11 bytes into a region of size 3 [-Werror=3Dformat-truncation=3D] 124 | snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d", vm_id= ); | ^~~~ qemu/target/i386/hax-posix.c:124:41: note: directive argument in the range [-2147483648, 64] 124 | snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d", vm_id= ); | ^~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/stdio.h:867, from qemu/include/qemu/osdep.h:99, from qemu/target/i386/hax-posix.c:14: /usr/include/bits/stdio2.h:67:10: note: =E2=80=98__builtin___snprintf_chk= =E2=80=99 output between 17 and 26 bytes into a destination of size 17 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - = 1, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 68 | __bos (__s), __fmt, __va_arg_pack ()); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Julio Faracco Signed-off-by: Paolo Bonzini --- target/i386/hax-posix.c | 33 ++------------------------------- target/i386/hax-windows.c | 33 ++------------------------------- 2 files changed, 4 insertions(+), 62 deletions(-) diff --git a/target/i386/hax-posix.c b/target/i386/hax-posix.c index a5426a6..3bad89f 100644 --- a/target/i386/hax-posix.c +++ b/target/i386/hax-posix.c @@ -108,41 +108,12 @@ int hax_mod_version(struct hax_state *hax, struct hax= _module_version *version) =20 static char *hax_vm_devfs_string(int vm_id) { - char *name; - - if (vm_id > MAX_VM_ID) { - fprintf(stderr, "Too big VM id\n"); - return NULL; - } - -#define HAX_VM_DEVFS "/dev/hax_vm/vmxx" - name =3D g_strdup(HAX_VM_DEVFS); - if (!name) { - return NULL; - } - - snprintf(name, sizeof HAX_VM_DEVFS, "/dev/hax_vm/vm%02d", vm_id); - return name; + return g_strdup_printf("/dev/hax_vm/vm%02d", vm_id); } =20 static char *hax_vcpu_devfs_string(int vm_id, int vcpu_id) { - char *name; - - if (vm_id > MAX_VM_ID || vcpu_id > MAX_VCPU_ID) { - fprintf(stderr, "Too big vm id %x or vcpu id %x\n", vm_id, vcpu_id= ); - return NULL; - } - -#define HAX_VCPU_DEVFS "/dev/hax_vmxx/vcpuxx" - name =3D g_strdup(HAX_VCPU_DEVFS); - if (!name) { - return NULL; - } - - snprintf(name, sizeof HAX_VCPU_DEVFS, "/dev/hax_vm%02d/vcpu%02d", - vm_id, vcpu_id); - return name; + return g_strdup_printf("/dev/hax_vm%02d/vcpu%02d", vm_id, vcpu_id); } =20 int hax_host_create_vm(struct hax_state *hax, int *vmid) diff --git a/target/i386/hax-windows.c b/target/i386/hax-windows.c index 5729ad9..0ba488c 100644 --- a/target/i386/hax-windows.c +++ b/target/i386/hax-windows.c @@ -185,41 +185,12 @@ int hax_mod_version(struct hax_state *hax, struct hax= _module_version *version) =20 static char *hax_vm_devfs_string(int vm_id) { - char *name; - - if (vm_id > MAX_VM_ID) { - fprintf(stderr, "Too big VM id\n"); - return NULL; - } - -#define HAX_VM_DEVFS "\\\\.\\hax_vmxx" - name =3D g_strdup(HAX_VM_DEVFS); - if (!name) { - return NULL; - } - - snprintf(name, sizeof HAX_VM_DEVFS, "\\\\.\\hax_vm%02d", vm_id); - return name; + return g_strdup_printf("/dev/hax_vm/vm%02d", vm_id); } =20 static char *hax_vcpu_devfs_string(int vm_id, int vcpu_id) { - char *name; - - if (vm_id > MAX_VM_ID || vcpu_id > MAX_VCPU_ID) { - fprintf(stderr, "Too big vm id %x or vcpu id %x\n", vm_id, vcpu_id= ); - return NULL; - } - -#define HAX_VCPU_DEVFS "\\\\.\\hax_vmxx_vcpuxx" - name =3D g_strdup(HAX_VCPU_DEVFS); - if (!name) { - return NULL; - } - - snprintf(name, sizeof HAX_VCPU_DEVFS, "\\\\.\\hax_vm%02d_vcpu%02d", - vm_id, vcpu_id); - return name; + return g_strdup_printf("/dev/hax_vm%02d/vcpu%02d", vm_id, vcpu_id); } =20 int hax_host_create_vm(struct hax_state *hax, int *vmid) --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395370; cv=none; d=zohomail.com; s=zohoarc; b=eYniIhbO3lVDwTnYZL0Y8kPMJYGia0R99nHa+Sun0B8VgHP4sYoHZ4EuPdzYeRX166tEY/RTAX+/Et8DaM3O9B4AvgZZ5MGOxAE0Hs4/br+yZvLlCOsiCEecL8v/jfyK092ZbF5ynjakRkEUxeI7N97bXGdkY7+o8EutcObQ96A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395370; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=PpGvtNCDlQfH6rOIsiKSImKl8aq6C5B4SOcZrIHugE4=; b=DZRLspkrau7Nsmb+yBSeNQIXXha7tn6zugctuBjrwuJ5PIYXxW/uQca9HzHXyjjlzSbkHTY1VSKaAx5hk+u8hMLi2dpVxmVmBVi9peYrv7HkmTLsawpBB0XtNm7a7HGhLqlxr4j26uNvMneMrdWSIReiSW7QS7tPakOXxHTGgWs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 15843953703024.142501504714005; Mon, 16 Mar 2020 14:49:30 -0700 (PDT) Received: from localhost ([::1]:49522 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxc1-0008Nu-9D for importer@patchew.org; Mon, 16 Mar 2020 17:49:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42153) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHT-0003QR-D0 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHS-0003tw-1g for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:15 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:39623) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHR-0003r9-RU for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:13 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-33-cdlhqBcxMbCwnDWozQgwlA-1; Mon, 16 Mar 2020 17:28:11 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1248B180454D; Mon, 16 Mar 2020 21:28:10 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D25719C4F; Mon, 16 Mar 2020 21:28:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394093; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PpGvtNCDlQfH6rOIsiKSImKl8aq6C5B4SOcZrIHugE4=; b=ahlQWJeJebsiF1T/zxI5U1+D7s7hUaTC7/UPmzhHeSG/iuKrKif4HvSVFIWc8jaIEa/XVZ 2nLxUZJ8SH6grh7nhERcAr4f+4+XRvJHc78zYv/AjIFYZ3B+tkmDH4U5Z0vQrkDm3ai4E2 ZdEIQTYL+9uwxTqxjSbJ1GhHAOQp01s= X-MC-Unique: cdlhqBcxMbCwnDWozQgwlA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 22/61] WHPX: Use proper synchronization primitives while processing Date: Mon, 16 Mar 2020 22:26:49 +0100 Message-Id: <1584394048-44994-23-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Sunil Muthuswamy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Sunil Muthuswamy WHPX wasn't using the proper synchronization primitives while processing async events, which can cause issues with SMP. Signed-off-by: Sunil Muthuswamy Signed-off-by: Paolo Bonzini --- target/i386/whpx-all.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/target/i386/whpx-all.c b/target/i386/whpx-all.c index cb863b7..c78baac 100644 --- a/target/i386/whpx-all.c +++ b/target/i386/whpx-all.c @@ -905,9 +905,8 @@ static void whpx_vcpu_process_async_events(CPUState *cp= u) =20 if ((cpu->interrupt_request & CPU_INTERRUPT_INIT) && !(env->hflags & HF_SMM_MASK)) { - + whpx_cpu_synchronize_state(cpu); do_cpu_init(x86_cpu); - cpu->vcpu_dirty =3D true; vcpu->interruptable =3D true; } =20 @@ -923,17 +922,13 @@ static void whpx_vcpu_process_async_events(CPUState *= cpu) } =20 if (cpu->interrupt_request & CPU_INTERRUPT_SIPI) { - if (!cpu->vcpu_dirty) { - whpx_get_registers(cpu); - } + whpx_cpu_synchronize_state(cpu); do_cpu_sipi(x86_cpu); } =20 if (cpu->interrupt_request & CPU_INTERRUPT_TPR) { cpu->interrupt_request &=3D ~CPU_INTERRUPT_TPR; - if (!cpu->vcpu_dirty) { - whpx_get_registers(cpu); - } + whpx_cpu_synchronize_state(cpu); apic_handle_tpr_access_report(x86_cpu->apic_state, env->eip, env->tpr_access_type); } @@ -1125,8 +1120,10 @@ static int whpx_vcpu_run(CPUState *cpu) =20 static void do_whpx_cpu_synchronize_state(CPUState *cpu, run_on_cpu_data a= rg) { - whpx_get_registers(cpu); - cpu->vcpu_dirty =3D true; + if (!cpu->vcpu_dirty) { + whpx_get_registers(cpu); + cpu->vcpu_dirty =3D true; + } } =20 static void do_whpx_cpu_synchronize_post_reset(CPUState *cpu, --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395055; cv=none; d=zohomail.com; s=zohoarc; b=BPHO2AbWHdmrg/JvVcXKlGESKuDDv8hcLfMdRhPl3uXDZsMWual9uILIxvs9qP+IsCsogL7z6XUAJd+hpb/uVNcSlOs1erKrMGwnWXQadxQb+8kwnsf0u3pKDQ+HEvIcm5qd3Pqj4PRTa+CyxCP4YqD6Gz4onPrF/1VxstLYo8k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395055; 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=MxyXzd1+M78f5LJXGIa385OSe7uymUkxw4jDQcSJ+g4=; b=WcjbzDEb/6bX6SF3HSFcdwc1scrmd0iY/VS6j2bjdsd5AJZSBUnKKMzGDyXPbp0UgG7RVwSDRidvcxf+uVJijcfo1OHDurgbUV6Kffm1fGxjL2PyFQqJoR6wY4CsyC4+2JPze7qKxj5Xq1lT61OOMlThozEktKxEKgitt+DhaW4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395055783238.07609206721054; Mon, 16 Mar 2020 14:44:15 -0700 (PDT) Received: from localhost ([::1]:49452 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxWw-0000sq-P6 for importer@patchew.org; Mon, 16 Mar 2020 17:44:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42227) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHV-0003VY-Ub for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHU-00049A-CS for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:17 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:26541) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHU-00046V-5o for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-cBKrsaOQOWC41H6eCOXiQw-1; Mon, 16 Mar 2020 17:28:14 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 302E2100550E for ; Mon, 16 Mar 2020 21:28:13 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BE9E19C4F; Mon, 16 Mar 2020 21:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MxyXzd1+M78f5LJXGIa385OSe7uymUkxw4jDQcSJ+g4=; b=Sni6kUeg/FOBQ1yN0m6DtjXe7ucUybWGM4pMGU0Oq4aUpOy5twoAh32Ww8XoV5barni7iO vohIxJ1aeRt5KefK/va3LoGXGn1eYVuy6wIkzeCCACSM+o8KKKBL2Vj2AAHfkskIOGIMjG WoHG9EplOusNNHP7aZjWVfVcV3GCYdk= X-MC-Unique: cBKrsaOQOWC41H6eCOXiQw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 23/61] Makefile: Align 'help' target output Date: Mon, 16 Mar 2020 22:26:50 +0100 Message-Id: <1584394048-44994-24-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 The 'help' target is displayed unaligned. Add a print-help function and use it. Now if someone want to change the indentation, there is a single place to modify. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- Makefile | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 7df22fc..6ec19f8 100644 --- a/Makefile +++ b/Makefile @@ -1235,50 +1235,52 @@ endif include $(SRC_PATH)/tests/docker/Makefile.include include $(SRC_PATH)/tests/vm/Makefile.include =20 +print-help-run =3D printf " %-30s - %s\\n" "$1" "$2" +print-help =3D $(quiet-@)$(call print-help-run,$1,$2) + .PHONY: help help: @echo 'Generic targets:' - @echo ' all - Build all' + $(call print-help,all,Build all) ifdef CONFIG_MODULES - @echo ' modules - Build all modules' + $(call print-help,modules,Build all modules) endif - @echo ' dir/file.o - Build specified target only' - @echo ' install - Install QEMU, documentation and tools' - @echo ' ctags/TAGS - Generate tags file for editors' - @echo ' cscope - Generate cscope index' + $(call print-help,dir/file.o,Build specified target only) + $(call print-help,install,Install QEMU, documentation and tools) + $(call print-help,ctags/TAGS,Generate tags file for editors) + $(call print-help,cscope,Generate cscope index) @echo '' @$(if $(TARGET_DIRS), \ echo 'Architecture specific targets:'; \ $(foreach t, $(TARGET_DIRS), \ - printf " %-30s - Build for %s\\n" $(t)/all $(t);) \ + $(call print-help-run,$(t)/all,Build for $(t));) \ echo '') @echo 'Cleaning targets:' - @echo ' clean - Remove most generated files but keep the conf= ig' + $(call print-help,clean,Remove most generated files but keep the config) ifdef CONFIG_GCOV - @echo ' clean-coverage - Remove coverage files' + $(call print-help,clean-coverage,Remove coverage files) endif - @echo ' distclean - Remove all generated files' - @echo ' dist - Build a distributable tarball' + $(call print-help,distclean,Remove all generated files) + $(call print-help,dist,Build a distributable tarball) @echo '' @echo 'Test targets:' - @echo ' check - Run all tests (check-help for details)' - @echo ' docker - Help about targets running tests inside conta= iners' - @echo ' vm-help - Help about targets running tests inside VM' + $(call print-help,check,Run all tests (check-help for details)) + $(call print-help,docker,Help about targets running tests inside containe= rs) + $(call print-help,vm-help,Help about targets running tests inside VM) @echo '' @echo 'Documentation targets:' - @echo ' html info pdf txt' - @echo ' - Build documentation in specified format' + $(call print-help,html info pdf txt,Build documentation in specified form= at) ifdef CONFIG_GCOV - @echo ' coverage-report - Create code coverage report' + $(call print-help,coverage-report,Create code coverage report) endif @echo '' ifdef CONFIG_WIN32 @echo 'Windows targets:' - @echo ' installer - Build NSIS-based installer for QEMU' + $(call print-help,installer,Build NSIS-based installer for QEMU) ifdef QEMU_GA_MSI_ENABLED - @echo ' msi - Build MSI-based installer for qemu-ga' + $(call print-help,msi,Build MSI-based installer for qemu-ga) endif @echo '' endif - @echo ' $(MAKE) [targets] (quiet build, default)' - @echo ' $(MAKE) V=3D1 [targets] (verbose build)' + $(call print-help,$(MAKE) [targets],(quiet build, default)) + $(call print-help,$(MAKE) V=3D1 [targets],(verbose build)) --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394891; cv=none; d=zohomail.com; s=zohoarc; b=DyD8dPCoP2hqasDKuwIF6FGD0atvlMFHCfQavK2BFyyv1ir8nivS0aPqyJZbCcuo7iaVpvLDzZf4iSkbF2X2Sc7A/kPkRMA4UuAfPDJb5dATKCe6Yw4m4h+YojtqZhc1+8eDVsC5ga3e3dr/Tey0j/YpZAZ80OAdmZFWPiZ5dwE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394891; 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=JHmCL3a+xAfKgSq86Fdzp47nnxo0weWCnyOq498MzaQ=; b=McYHZeJ7lWpKl/O2Cu2cQj7ReLIlQa90xAIX7JHw+at0W5wpgbz1p+aal7bWWwc9b9xkWU4Q5T9u4Y/cHtYgb2XFP39RVArz/qBkAfVWHSB4JTZDavvkD0cpidmy/D+dTW51IX6tS29cPLu55IRRuEZx6zHZYKgPjohunEvT7bk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 15843948910801014.5230621135153; Mon, 16 Mar 2020 14:41:31 -0700 (PDT) Received: from localhost ([::1]:49422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxUH-0004Hm-UD for importer@patchew.org; Mon, 16 Mar 2020 17:41:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42318) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHa-0003Z3-8y for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHY-0004Vi-7w for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:21 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:20614) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHY-0004VK-3L for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-232-ceghNtbpOIyPlNM-OmVRkw-1; Mon, 16 Mar 2020 17:28:17 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0EF51804540 for ; Mon, 16 Mar 2020 21:28:15 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 998EB19C4F; Mon, 16 Mar 2020 21:28:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JHmCL3a+xAfKgSq86Fdzp47nnxo0weWCnyOq498MzaQ=; b=P/lR3g6H/IipQUUZQ4MUxt1YibSOyyxCHR1us6yA2+QaGX3Zz6cEQXlg3+2odXmlg6VTTd S0qGq1wta4ocMmQE8Gm9WoxJ6pDv6COuybCCu+GzYn8e4T7IezDZ8VUrKgBx6hn0jD0Mlo v5HHYRopFNNmunVwZcGsn4lLVeixTIM= X-MC-Unique: ceghNtbpOIyPlNM-OmVRkw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 24/61] Makefile: Let the 'help' target list the tools targets Date: Mon, 16 Mar 2020 22:26:51 +0100 Message-Id: <1584394048-44994-25-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 List the name of the tool targets when calling 'make help': $ make help [...] Tools targets: qemu-ga - Build qemu-ga tool qemu-keymap - Build qemu-keymap tool elf2dmp - Build elf2dmp tool ivshmem-client - Build ivshmem-client tool ivshmem-server - Build ivshmem-server tool qemu-nbd - Build qemu-nbd tool qemu-img - Build qemu-img tool qemu-io - Build qemu-io tool qemu-edid - Build qemu-edid tool fsdev/virtfs-proxy-helper - Build virtfs-proxy-helper tool scsi/qemu-pr-helper - Build qemu-pr-helper tool Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index 6ec19f8..25a7056 100644 --- a/Makefile +++ b/Makefile @@ -1255,6 +1255,11 @@ endif $(foreach t, $(TARGET_DIRS), \ $(call print-help-run,$(t)/all,Build for $(t));) \ echo '') + @$(if $(TOOLS), \ + echo 'Tools targets:'; \ + $(foreach t, $(TOOLS), \ + $(call print-help-run,$(t),Build $(shell basename $(t)) tool);) \ + echo '') @echo 'Cleaning targets:' $(call print-help,clean,Remove most generated files but keep the config) ifdef CONFIG_GCOV --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395015; cv=none; d=zohomail.com; s=zohoarc; b=JfSpunMZo7lkh/mjPX/5BFqcy3YbL6kYFJ8i/2uGDUjBS2YB0OS/0lFSPleNRYq0oYonzdK/e6+3g/5f+5IRRKpg+hpW8GCuHmf2frOyzpcCgqkpF++DzMLtjixO6MOy5R9x5uzH1UhrjKKNTJUflpr6frW6Vp0MfGpK33EpiUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395015; 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=APH5QeUNY4+QdIZjt0jLIZOSs0GF5eMKvhg6Of9TREg=; b=CJmVMzaEqQEGOyIKCM2gHAzg6bWSH3bzuv18Y2XWKA/eJ91qLqrgMZZoIcCtqp1JHQ3rgZVeVwjmvbWHG/G8B813EBAQ4Ebeo2L7Q6Ev1ejqClr+Yj7FalSbqjKZvoCUyQnckQo4wvCt1AwFR5YhjGL0Lu7aXKpy/H2YuKFBwJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395015073544.873269955091; Mon, 16 Mar 2020 14:43:35 -0700 (PDT) Received: from localhost ([::1]:49448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxWI-0007yR-0t for importer@patchew.org; Mon, 16 Mar 2020 17:43:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42315) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHa-0003Yx-6k for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHZ-0004dC-5o for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:22 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:51690) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHZ-0004Wq-0O for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-GQnqhdomP5u6yrQGSzR4Og-1; Mon, 16 Mar 2020 17:28:19 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4AA69800D53 for ; Mon, 16 Mar 2020 21:28:18 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46A3F19C4F; Mon, 16 Mar 2020 21:28:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394100; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=APH5QeUNY4+QdIZjt0jLIZOSs0GF5eMKvhg6Of9TREg=; b=HMgGV3PU/Z9NaRaSulg5sltz9qk45BtLDlJ1ZAGou0VC2dAmKbDRM9f5luipAV1MRPltmU 5Gu83SppZUkvuH2zZLi/PLiyqLYwq8umcqDFtlengsVufbegbKsHBMj5KrZjzH9mKxgNhD nqOpCP6MsS1MafjOiIJKydAuJNQffeA= X-MC-Unique: GQnqhdomP5u6yrQGSzR4Og-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 25/61] hw/audio/fmopl: Move ENV_CURVE to .heap to save 32KiB of .bss Date: Mon, 16 Mar 2020 22:26:52 +0100 Message-Id: <1584394048-44994-26-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This buffer is only used by the adlib audio device. Move it to the .heap to release 32KiB of .bss (size reported on x86_64 host). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella Signed-off-by: Paolo Bonzini --- hw/audio/fmopl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/audio/fmopl.c b/hw/audio/fmopl.c index 173a752..356d4df 100644 --- a/hw/audio/fmopl.c +++ b/hw/audio/fmopl.c @@ -186,7 +186,7 @@ static int32_t *VIB_TABLE; =20 /* envelope output curve table */ /* attack + decay + OFF */ -static int32_t ENV_CURVE[2*EG_ENT+1]; +static int32_t *ENV_CURVE; =20 /* multiple table */ #define ML 2 @@ -1090,6 +1090,7 @@ FM_OPL *OPLCreate(int clock, int rate) OPL->clock =3D clock; OPL->rate =3D rate; OPL->max_ch =3D max_ch; + ENV_CURVE =3D g_new(int32_t, 2 * EG_ENT + 1); /* init grobal tables */ OPL_initialize(OPL); /* reset chip */ @@ -1127,6 +1128,7 @@ void OPLDestroy(FM_OPL *OPL) #endif OPL_UnLockTable(); free(OPL); + g_free(ENV_CURVE); } =20 /* ---------- Option handlers ---------- */ --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394793; cv=none; d=zohomail.com; s=zohoarc; b=TVxtON/XjLO7UsXnVFGL+zOZ0ddCV5ApQGuRmtlB9avAlFrKNTifXTPDeh3koGt1wL1yg749TWOKAIHqLJpUDHs7v/bZgn2qAGDa5EolXT6MUF/O3k7N3UIIYrLhjz3ywOg31Yv/UN74Un7IX39CIruSYV5GPkC0SkWJ9bUNq90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394793; 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=WK5h4P8m8J06henO1MK/mBW4W9LphSNTnmEs0tNIUNI=; b=F4oaF3THBWDDffH8pj8KW7n07C6ML4JK6AtT19WQsbW64WiScfG081B/U/QKRtdZP7vYKXeqmEAhK/gAozbn2RVXGz/CtmT/Koyb8PKjH52RIqYeSanvhbRxSQrlhCQOVoz3d+AVpu3jqDSNd/ziHXP6LjGqegm+CB72/YMcYmo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394793769563.0624325015998; Mon, 16 Mar 2020 14:39:53 -0700 (PDT) Received: from localhost ([::1]:49388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxSi-0001y4-Ng for importer@patchew.org; Mon, 16 Mar 2020 17:39:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42403) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHd-0003fv-Sz for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHb-0004pg-QW for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:25 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:21354) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHb-0004oA-L6 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:23 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-4lyT3BCQMxChqMIJRu6LdA-1; Mon, 16 Mar 2020 17:28:21 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6FC7800D50 for ; Mon, 16 Mar 2020 21:28:20 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B441319C4F; Mon, 16 Mar 2020 21:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WK5h4P8m8J06henO1MK/mBW4W9LphSNTnmEs0tNIUNI=; b=OrNqDE4CI9jliLCchSG2Vy8pNghdoUFkXdaL7DUvjzkJLAWtWR5cxGdDPr7KWIWfUc5hIH BppLZI+3gAxLTy94wrnlNyK+k2MbYW4/1CZSURNU8m0DkOugsmPWu/67874A4Zm8QmEGgS 0iw92c0TxHYlnFrbuK4f5IeN9kXw1cI= X-MC-Unique: 4lyT3BCQMxChqMIJRu6LdA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 26/61] hw/audio/intel-hda: Use memory region alias to reduce .rodata by 4.34MB Date: Mon, 16 Mar 2020 22:26:53 +0100 Message-Id: <1584394048-44994-27-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 The intel-hda model uses an array of register indexed by the register address. This array also contains a pair of aliased registers at offset 0x2000. This creates a huge hole in the array, which ends up eating 4.6MiB of .rodata (size reported on x86_64 host, building with --extra-cflags=3D-Os). By using a memory region alias, we reduce this array to 132kB. Before: (qemu) info mtree 00000000febd4000-00000000febd7fff (prio 1, i/o): intel-hda After: (qemu) info mtree 00000000febd4000-00000000febd7fff (prio 1, i/o): intel-hda 00000000febd4000-00000000febd7fff (prio 1, i/o): intel-hda-container 00000000febd4000-00000000febd5fff (prio 0, i/o): intel-hda 00000000febd6000-00000000febd7fff (prio 0, i/o): alias intel-hda-alia= s @intel-hda 0000000000000000-0000000000001fff Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/audio/intel-hda.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c index 1bcc3e5..e8d18b7 100644 --- a/hw/audio/intel-hda.c +++ b/hw/audio/intel-hda.c @@ -181,7 +181,9 @@ struct IntelHDAState { IntelHDAStream st[8]; =20 /* state */ + MemoryRegion container; MemoryRegion mmio; + MemoryRegion alias; uint32_t rirb_count; int64_t wall_base_ns; =20 @@ -670,12 +672,6 @@ static const struct IntelHDAReg regtab[] =3D { .offset =3D offsetof(IntelHDAState, wall_clk), .rhandler =3D intel_hda_get_wall_clk, }, - [ ICH6_REG_WALLCLK + 0x2000 ] =3D { - .name =3D "WALLCLK(alias)", - .size =3D 4, - .offset =3D offsetof(IntelHDAState, wall_clk), - .rhandler =3D intel_hda_get_wall_clk, - }, =20 /* dma engine */ [ ICH6_REG_CORBLBASE ] =3D { @@ -837,12 +833,6 @@ static const struct IntelHDAReg regtab[] =3D { .size =3D 4, \ .offset =3D offsetof(IntelHDAState, st[_i].lpib), \ }, \ - [ ST_REG(_i, ICH6_REG_SD_LPIB) + 0x2000 ] =3D { \ - .stream =3D _i, \ - .name =3D _t stringify(_i) " LPIB(alias)", \ - .size =3D 4, \ - .offset =3D offsetof(IntelHDAState, st[_i].lpib), \ - }, \ [ ST_REG(_i, ICH6_REG_SD_CBL) ] =3D { \ .stream =3D _i, \ .name =3D _t stringify(_i) " CBL", \ @@ -1125,9 +1115,15 @@ static void intel_hda_realize(PCIDevice *pci, Error = **errp) error_free(err); } =20 + memory_region_init(&d->container, OBJECT(d), + "intel-hda-container", 0x4000); memory_region_init_io(&d->mmio, OBJECT(d), &intel_hda_mmio_ops, d, - "intel-hda", 0x4000); - pci_register_bar(&d->pci, 0, 0, &d->mmio); + "intel-hda", 0x2000); + memory_region_add_subregion(&d->container, 0x0000, &d->mmio); + memory_region_init_alias(&d->alias, OBJECT(d), "intel-hda-alias", + &d->mmio, 0, 0x2000); + memory_region_add_subregion(&d->container, 0x2000, &d->alias); + pci_register_bar(&d->pci, 0, 0, &d->container); =20 hda_codec_bus_init(DEVICE(pci), &d->codecs, sizeof(d->codecs), intel_hda_response, intel_hda_xfer); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395227; cv=none; d=zohomail.com; s=zohoarc; b=KoUPLcYPYz75urQVfjvRcHzpGHqX4KHMYF7+mZNgv7smJ4KKAUG9Czb7uaoROBRLXnYbG15eMbRObl6EUvWuf9lZzgzqmnKQGRSeq3ruSWPkZoqB/8R4cicmnvyWadRzJ9K7OeUx/bgum/WDVK6BNme7ASjGiZ3qSFAA2Ef4tn4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395227; 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=WOnGfxVvr/2gh78JhcyB0MNCc4EfkJRvrQjMy1iHHM8=; b=A6hG8iZn5ymk7pDWfMtI1DLNVKyvlOUx7djK8RJZmcapRcd2FEwX0wt4EOQggRdyZ5yYLbSvaoMOYw1GnYU0z3fAOx3OvWqo9cMs7nU9vL0JtNQuiHIfTx4DbfhGYVHhteDc+8xn28JoQWt+DeVWx121ONxgOn1FxQUunAGc1To= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395227037901.5449879528095; Mon, 16 Mar 2020 14:47:07 -0700 (PDT) Received: from localhost ([::1]:49494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxZi-0004M2-0Z for importer@patchew.org; Mon, 16 Mar 2020 17:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42476) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHg-0003kf-DC for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHf-00052y-5O for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:28 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:47907) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHe-00051S-Vz for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:27 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-440-tWaDFzbXPm-Uw49b0F9TkQ-1; Mon, 16 Mar 2020 17:28:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 71B28100726B for ; Mon, 16 Mar 2020 21:28:23 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C00519C4F; Mon, 16 Mar 2020 21:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394106; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WOnGfxVvr/2gh78JhcyB0MNCc4EfkJRvrQjMy1iHHM8=; b=KlkNHDPIdWgGEZLq6U4/Wbq1LFiErRvmpPzq3oMh1nByPqh6obwTAa+eD1YoAqhQ7o8vDi NFlF7z6jjh03mSDeEd02towGm0DrJRY+qo+ntTP34nknXodB9iac2ME3J+d9qRfUApnAMi s9Syhcr/5KFWKyGV+WVpYxjcCx4I5mw= X-MC-Unique: tWaDFzbXPm-Uw49b0F9TkQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 27/61] hw/usb/quirks: Use smaller types to reduce .rodata by 10KiB Date: Mon, 16 Mar 2020 22:26:54 +0100 Message-Id: <1584394048-44994-28-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 The USB descriptor sizes are specified as 16-bit for idVendor / idProduct, and 8-bit for bInterfaceClass / bInterfaceSubClass / bInterfaceProtocol. Doing so we reduce the usbredir_raw_serial_ids[] and usbredir_ftdi_serial_ids[] arrays from 16KiB to 6KiB (size reported on x86_64 host, building with --extra-cflags=3D-Os). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- hw/usb/quirks.c | 4 ++-- hw/usb/quirks.h | 22 +++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/usb/quirks.c b/hw/usb/quirks.c index 38a9c56..23ea7a2 100644 --- a/hw/usb/quirks.c +++ b/hw/usb/quirks.c @@ -22,10 +22,10 @@ static bool usb_id_match(const struct usb_device_id *id= s, uint8_t interface_protocol) { int i; =20 - for (i =3D 0; ids[i].vendor_id !=3D -1; i++) { + for (i =3D 0; ids[i].terminating_entry =3D=3D 0; i++) { if (ids[i].vendor_id =3D=3D vendor_id && ids[i].product_id =3D=3D product_id && - (ids[i].interface_class =3D=3D -1 || + (ids[i].interface_protocol_used =3D=3D 0 || (ids[i].interface_class =3D=3D interface_class && ids[i].interface_subclass =3D=3D interface_subclass && ids[i].interface_protocol =3D=3D interface_protocol))) { diff --git a/hw/usb/quirks.h b/hw/usb/quirks.h index 89480be..50ef2f9 100644 --- a/hw/usb/quirks.h +++ b/hw/usb/quirks.h @@ -21,19 +21,23 @@ #include "quirks-pl2303-ids.h" =20 struct usb_device_id { - int vendor_id; - int product_id; - int interface_class; - int interface_subclass; - int interface_protocol; + uint16_t vendor_id; + uint16_t product_id; + uint8_t interface_class; + uint8_t interface_subclass; + uint8_t interface_protocol; + uint8_t interface_protocol_used:1, + terminating_entry:1, + reserved:6; }; =20 #define USB_DEVICE(vendor, product) \ - .vendor_id =3D vendor, .product_id =3D product, .interface_class =3D -= 1, + .vendor_id =3D vendor, .product_id =3D product, .interface_protocol_us= ed =3D 0, =20 #define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, iclass, isubclass, iprot= o) \ .vendor_id =3D vend, .product_id =3D prod, .interface_class =3D iclass= , \ - .interface_subclass =3D isubclass, .interface_protocol =3D iproto + .interface_subclass =3D isubclass, .interface_protocol =3D iproto, \ + .interface_protocol_used =3D 1 =20 static const struct usb_device_id usbredir_raw_serial_ids[] =3D { /* @@ -206,7 +210,7 @@ static const struct usb_device_id usbredir_raw_serial_i= ds[] =3D { { USB_DEVICE(ADLINK_VENDOR_ID, ADLINK_ND6530_PRODUCT_ID) }, { USB_DEVICE(SMART_VENDOR_ID, SMART_PRODUCT_ID) }, =20 - { USB_DEVICE(-1, -1) } /* Terminating Entry */ + { .terminating_entry =3D 1 } /* Terminating Entry */ }; =20 static const struct usb_device_id usbredir_ftdi_serial_ids[] =3D { @@ -906,7 +910,7 @@ static const struct usb_device_id usbredir_ftdi_serial_= ids[] =3D { { USB_DEVICE(FTDI_VID, FTDI_DISTORTEC_JTAG_LOCK_PICK_PID) }, { USB_DEVICE(FTDI_VID, FTDI_LUMEL_PD12_PID) }, =20 - { USB_DEVICE(-1, -1) } /* Terminating Entry */ + { .terminating_entry =3D 1 } /* Terminating Entry */ }; =20 #undef USB_DEVICE --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395560; cv=none; d=zohomail.com; s=zohoarc; b=eJ29vsnFF5eBEZMuQ7buumiXfetVRA5yj8p+zcjx1n/94SfPeo7iQ22eOvk0AUWqnPOJFzEQ2sTxpj+xnFlDY22WR6TQbsjDwx7L43U5iVGsNA19yA/JRiTfxcXiDUEA79g7UY6BtdfakV84yrmagmF5L/Ji11kNSU6jnckVw7A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395560; 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=2+BOl0amfKr7UXhgG4Q7Xq9HkrFNXXEvNrFeurKand0=; b=YE0/USEz3VBCkBaI2hlHFSrDBCylzVi0nCw6x/eFS5M9MqbeQxLySIq/opdrSb9iXotQBsyqzoZuosCkRUrbFbZ/7BWtw3XADOOMl+ao6ZS3G7/eYp5Od2G0OAtvYDIYqWRzjSTD0ayuN+ZxSGJWIuYWDLYAc07INBLwsnYrgBc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395560283146.97159785838653; Mon, 16 Mar 2020 14:52:40 -0700 (PDT) Received: from localhost ([::1]:49564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxf5-0004y5-9G for importer@patchew.org; Mon, 16 Mar 2020 17:52:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42542) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHi-0003q0-NI for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHh-0005Mi-IB for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:30 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:36995) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHh-0005Jb-Cz for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:29 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-115-RlI9FaEZMueS5TZE10qkew-1; Mon, 16 Mar 2020 17:28:25 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CB410149CC for ; Mon, 16 Mar 2020 21:28:24 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id D7C3B19C4F; Mon, 16 Mar 2020 21:28:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394109; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2+BOl0amfKr7UXhgG4Q7Xq9HkrFNXXEvNrFeurKand0=; b=QnmsEWBWL9E9Q5v+amVr+ScmWDP4BsjifSb1VU9F24DAsNTuO3dnaTEee8BxF1hY3ARkcH ColM++kMnBU3HKZOfEevliGqRTgC6EZEKC3j5khVpk8snJTY05HoESC/YxMUEm++65gBK3 m86+ydX3dzfPoaD/1HNlBCWMWxbOrcs= X-MC-Unique: RlI9FaEZMueS5TZE10qkew-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 28/61] ui/curses: Make control_characters[] array const Date: Mon, 16 Mar 2020 22:26:55 +0100 Message-Id: <1584394048-44994-29-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 As we only use this array as input, make it const. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Stefano Garzarella Signed-off-by: Paolo Bonzini --- ui/curses.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/curses.c b/ui/curses.c index 3a1b714..3bafc10 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -529,7 +529,7 @@ static void font_setup(void) * Control characters are normally non-printable, but VGA does have * well-known glyphs for them. */ - static uint16_t control_characters[0x20] =3D { + static const uint16_t control_characters[0x20] =3D { 0x0020, 0x263a, 0x263b, --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395494; cv=none; d=zohomail.com; s=zohoarc; b=UCzA0QVj0ARHWQFbuepkA13unBvGjUwALM4hSWbhNWcpDzHlfU0uB7unOjp7guzDW8Mz6eFBS8DZasNmRaRKoB4kPWQfxsU8ghEb8LbDjiUl3t3oKX5jLIU7DeZyv652v/qfbgIYZyyDVmlaLfjwQZMp0d59e+W78PyD5Oz4L3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395494; 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=h648SmwpCvwN1dBwySehpb4Gdc3DelTHBZmWsV2C42c=; b=BYq5eKY6F3Zab/oVt6Brag/n/PI7EXftk0JJjS/jdJcM9kCY7V4MUsqkp4wklTNS33Cpo15SRKAJw7XwIMJSApnrLT/Cdav0N1Dc16fBYFdJiz6H0W4jSkovVmF9zht/+s5EbVDIF2bRhrwVf8Rxkyxbhwf5g9ZdU9Y56tGlykg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395494445469.65536697230334; Mon, 16 Mar 2020 14:51:34 -0700 (PDT) Received: from localhost ([::1]:49556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxe1-0003Hw-C8 for importer@patchew.org; Mon, 16 Mar 2020 17:51:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42761) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHs-00044E-1F for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHo-0006EL-Uk for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:39 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:45770) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHo-0006BT-Ps for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-201-vnpjGgGQOvugPX1o4xtHvw-1; Mon, 16 Mar 2020 17:28:27 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3437C1085936 for ; Mon, 16 Mar 2020 21:28:26 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 405AA19C4F; Mon, 16 Mar 2020 21:28:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h648SmwpCvwN1dBwySehpb4Gdc3DelTHBZmWsV2C42c=; b=HiRkIFr81c3n4yx03zVrJ2tex/oOIBZTgNMZ0dpgQ+kDXHS5QLYcnO5yKPyiqRM+siWwFI WVsp1G89Y30mfYhvnuQi9X20xVHQhKdtefU/hqj3d2mmrpyIvRF7pEnnCUDm2pWKX5oXci RnucTxvTCAABdHjnfQQImIwNBe1nMd8= X-MC-Unique: vnpjGgGQOvugPX1o4xtHvw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 29/61] ui/curses: Move arrays to .heap to save 74KiB of .bss Date: Mon, 16 Mar 2020 22:26:56 +0100 Message-Id: <1584394048-44994-30-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 We only need these arrays when using the curses display. Move them from the .bss to the .heap (sizes reported on x86_64 host: screen[] is 64KiB, vga_to_curses 7KiB). Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Paolo Bonzini --- ui/curses.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/curses.c b/ui/curses.c index 3bafc10..a59b23a 100644 --- a/ui/curses.c +++ b/ui/curses.c @@ -54,13 +54,13 @@ enum maybe_keycode { }; =20 static DisplayChangeListener *dcl; -static console_ch_t screen[160 * 100]; +static console_ch_t *screen; static WINDOW *screenpad =3D NULL; static int width, height, gwidth, gheight, invalidate; static int px, py, sminx, sminy, smaxx, smaxy; =20 static const char *font_charset =3D "CP437"; -static cchar_t vga_to_curses[256]; +static cchar_t *vga_to_curses; =20 static void curses_update(DisplayChangeListener *dcl, int x, int y, int w, int h) @@ -405,6 +405,8 @@ static void curses_refresh(DisplayChangeListener *dcl) static void curses_atexit(void) { endwin(); + g_free(vga_to_curses); + g_free(screen); } =20 /* @@ -783,6 +785,8 @@ static void curses_display_init(DisplayState *ds, Displ= ayOptions *opts) if (opts->u.curses.charset) { font_charset =3D opts->u.curses.charset; } + screen =3D g_new0(console_ch_t, 160 * 100); + vga_to_curses =3D g_new0(cchar_t, 256); curses_setup(); curses_keyboard_setup(); atexit(curses_atexit); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395808; cv=none; d=zohomail.com; s=zohoarc; b=OV0BiVKsiSHMhT7JW34T8rxT4PF9VtOSPIOlx745aXRh9cYSnZdn2xsjQiq16R5Skb66ttUKDzfulCMtFJ9wYlM/A45px/69drB1jqRTbOVt9/J/S7S66O0d4HKfEH28Q59WeRHq8amcTIK89zfOibU4oV6bg1d6u9ZJzCTGVFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395808; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=KqxX7RV+tk2/7J3Xr0yT/Gwt34XZbIeFvDkXq7c9x5U=; b=jju1RBoFXLncF5x0JXjb6L28zrLOFAJ4xy+jMcuBCLQU2Jc2YSnRT0/pQ/GM+0v6j5aNKWQwY9gJWMh9eR7GqeIQbY2geEpznJlzPj1HAP+JLJ1GYt2FO8cztXA7iSHsEo54KHHiEMQlJwa1jlj5eVx7R+h8X5TzoDyAM9N2GMM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395808606314.3385584286972; Mon, 16 Mar 2020 14:56:48 -0700 (PDT) Received: from localhost ([::1]:49626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxj5-0003p9-HA for importer@patchew.org; Mon, 16 Mar 2020 17:56:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42802) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHu-00045P-VR for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHs-0006Mu-4s for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:41 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:24882) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHr-0006Gv-V9 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:40 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-466-gUk2UZ3DOSOtSaptpi3BEw-1; Mon, 16 Mar 2020 17:28:30 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D223D149C3 for ; Mon, 16 Mar 2020 21:28:29 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9CED519C4F; Mon, 16 Mar 2020 21:28:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KqxX7RV+tk2/7J3Xr0yT/Gwt34XZbIeFvDkXq7c9x5U=; b=RbhdHToVy5MND+NkvyN/oc9cJJprOZHXAZH9VjgcpLhrWx4/Z5e1/X6YTS76OC3GLi+jbP 4TtezJ2xjRjRUr/j+CGP9gvEkU6faeFAI5TphvVla6HIpuUvTmRU6ZfkGqegPeiJTEi797 qAv418Il/U9tcdfiOogrigHxLFf322U= X-MC-Unique: gUk2UZ3DOSOtSaptpi3BEw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 30/61] qemu-cpu-models.rst: Document -noTSX, mds-no, taa-no, and tsx-ctrl Date: Mon, 16 Mar 2020 22:26:57 +0100 Message-Id: <1584394048-44994-31-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Kashyap Chamarthy Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Kashyap Chamarthy - Add the '-noTSX' variants for CascadeLake and SkyLake. - Document the three MSR bits: 'mds-no', 'taa-no', and 'tsx-ctrl' Two confusing things about 'mds-no' (and the first point applies to the other two MSRs too): (1) The 'mds-no' bit will _not_ show up in the guest's /proc/cpuinfo. Rather it is used to fill in the guest's sysfs: /sys/devices/system/cpu/vulnerabilities/mds:Not affected Paolo confirmed on IRC as such. (2) There are _three_ variants[+] of CascadeLake CPUs, with different stepping levels: 5, 6, and 7. To quote wikichip.org[*]: "note that while steppings 6 & 7 are fully mitigated, earlier stepping 5 is not protected against MSBDS, MLPDS, nor MDSUM" The above is also indicated in the Intel's document[+], as indicated by "No" under the three columns of MFBDS, MSBDS, and MLPDS. I've expressed this in the docs without belabouring the details. [+] https://software.intel.com/security-software-guidance/insights/pr= ocessors-affected-microarchitectural-data-sampling [*] https://en.wikichip.org/wiki/intel/microarchitectures/cascade_lak= e#Key_changes_from_Skylake Signed-off-by: Kashyap Chamarthy Message-Id: <20200225165618.6571-3-kchamart@redhat.com> Signed-off-by: Paolo Bonzini --- docs/system/cpu-models-x86.rst.inc | 57 ++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 55 insertions(+), 2 deletions(-) diff --git a/docs/system/cpu-models-x86.rst.inc b/docs/system/cpu-models-x8= 6.rst.inc index cbad930..9a23278 100644 --- a/docs/system/cpu-models-x86.rst.inc +++ b/docs/system/cpu-models-x86.rst.inc @@ -49,10 +49,15 @@ mixture of host CPU models between machines, if live mi= gration compatibility is required, use the newest CPU model that is compatible across all desired hosts. =20 -``Skylake-Server``, ``Skylake-Server-IBRS`` +``Cascadelake-Server``, ``Cascadelake-Server-noTSX`` + Intel Xeon Processor (Cascade Lake, 2019), with "stepping" levels 6 + or 7 only. (The Cascade Lake Xeon processor with *stepping 5 is + vulnerable to MDS variants*.) + +``Skylake-Server``, ``Skylake-Server-IBRS``, ``Skylake-Server-IBRS-noTSX`` Intel Xeon Processor (Skylake, 2016) =20 -``Skylake-Client``, ``Skylake-Client-IBRS`` +``Skylake-Client``, ``Skylake-Client-IBRS``, ``Skylake-Client-noTSX-IBRS}`` Intel Core Processor (Skylake, 2015) =20 ``Broadwell``, ``Broadwell-IBRS``, ``Broadwell-noTSX``, ``Broadwell-noTSX-= IBRS`` @@ -148,6 +153,54 @@ features are included if using "Host passthrough" or "= Host model". Requires the host CPU microcode to support this feature before it can be used for guest CPUs. =20 +``mds-no`` + Recommended to inform the guest OS that the host is *not* vulnerable + to any of the MDS variants ([MFBDS] CVE-2018-12130, [MLPDS] + CVE-2018-12127, [MSBDS] CVE-2018-12126). + + This is an MSR (Model-Specific Register) feature rather than a CPUID fea= ture, + so it will not appear in the Linux ``/proc/cpuinfo`` in the host or + guest. Instead, the host kernel uses it to populate the MDS + vulnerability file in ``sysfs``. + + So it should only be enabled for VMs if the host reports @code{Not + affected} in the ``/sys/devices/system/cpu/vulnerabilities/mds`` file. + +``taa-no`` + Recommended to inform that the guest that the host is ``not`` + vulnerable to CVE-2019-11135, TSX Asynchronous Abort (TAA). + + This too is an MSR feature, so it does not show up in the Linux + ``/proc/cpuinfo`` in the host or guest. + + It should only be enabled for VMs if the host reports ``Not affected`` + in the ``/sys/devices/system/cpu/vulnerabilities/tsx_async_abort`` + file. + +``tsx-ctrl`` + Recommended to inform the guest that it can disable the Intel TSX + (Transactional Synchronization Extensions) feature; or, if the + processor is vulnerable, use the Intel VERW instruction (a + processor-level instruction that performs checks on memory access) as + a mitigation for the TAA vulnerability. (For details, refer to + Intel's `deep dive into MDS + `_.) + + Expose this to the guest OS if and only if: (a) the host has TSX + enabled; *and* (b) the guest has ``rtm`` CPU flag enabled. + + By disabling TSX, KVM-based guests can avoid paying the price of + mitigating TSX-based attacks. + + Note that ``tsx-ctrl`` too is an MSR feature, so it does not show + up in the Linux ``/proc/cpuinfo`` in the host or guest. + + To validate that Intel TSX is indeed disabled for the guest, there are + two ways: (a) check for the *absence* of ``rtm`` in the guest's + ``/proc/cpuinfo``; or (b) the + ``/sys/devices/system/cpu/vulnerabilities/tsx_async_abort`` file in + the guest should report ``Mitigation: TSX disabled``. + =20 Preferred CPU models for AMD x86 hosts ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395349; cv=none; d=zohomail.com; s=zohoarc; b=WojKZshbe+poNYdI+qCt43f/oeJs67cV2qbybDhc9Jixss3od0M+WRFQYhM76BetBNz16gSKVzk0SffGsMqTRejViHXteV7KLQInoVitHCyxvHznu2Eq+r8T3AJ3vu+JULi3M0L/5tK+pO9RUKBSCkBRfNl897V/eZ5hG7A6ycI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395349; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=HxC1eILjyyD4vXLg01tF8j7MmRukmacLFrXLAYZM6r4=; b=OjBNlwYdU4lByEj9UnJa0bvqwOBx0duZzIuhNk6sULuwjalgqTGkXMlIcu71GXIgBdccOnhRxIRw3Bu/Ve/L7AQsiZjaWLCAFylabLxeQq1kUBuZyQtf5a9GyZzi+GIWAsRvRVSFyFch6ZvP8I/1mKHdPB3zFQZkZTi1OFFr+NU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395349925789.2991557919509; Mon, 16 Mar 2020 14:49:09 -0700 (PDT) Received: from localhost ([::1]:49518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxbg-00083h-Ss for importer@patchew.org; Mon, 16 Mar 2020 17:49:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42764) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHs-00044I-2C for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHo-0006CQ-M6 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:39 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:38549) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHo-00068b-GG for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:36 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-11-iAUgFsVKNAiTFCetGgpXDA-1; Mon, 16 Mar 2020 17:28:32 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3E023149CF; Mon, 16 Mar 2020 21:28:31 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46AD319C4F; Mon, 16 Mar 2020 21:28:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HxC1eILjyyD4vXLg01tF8j7MmRukmacLFrXLAYZM6r4=; b=LopQyfnfFRMwh55F3fxmeLAgjmyAFye3GLLHkQLFUszkq0SzjPgCYPHnjqeuTndrJ6aeO+ czPtQ7Fu7ROj/aDth0I8CUclW8tAXKwycH4eJV1n2wjTcxoswCR2HNbQTOLrDYTThf8RvD mbLLvDhuQQSuRa7MNoVmmoYEmkrN3u8= X-MC-Unique: iAUgFsVKNAiTFCetGgpXDA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 31/61] softmmu/vl.c: Handle '-cpu help' and '-device help' before 'no default machine' Date: Mon, 16 Mar 2020 22:26:58 +0100 Message-Id: <1584394048-44994-32-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Peter Maydell Currently if you try to ask for the list of CPUs for a target architecture which does not specify a default machine type you just get an error: $ qemu-system-arm -cpu help qemu-system-arm: No machine specified, and there is no default Use -machine help to list supported machines Since the list of CPUs doesn't depend on the machine, this is unnecessarily unhelpful. "-device help" has a similar problem. Move the checks for "did the user ask for -cpu help or -device help" up so they precede the select_machine() call which checks that the user specified a valid machine type. Signed-off-by: Peter Maydell Signed-off-by: Paolo Bonzini --- softmmu/vl.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/softmmu/vl.c b/softmmu/vl.c index ff2685d..6a28592 100644 --- a/softmmu/vl.c +++ b/softmmu/vl.c @@ -3789,6 +3789,22 @@ void qemu_init(int argc, char **argv, char **envp) */ loc_set_none(); =20 + /* + * Check for -cpu help and -device help before we call select_machine(= ), + * which will return an error if the architecture has no default machi= ne + * type and the user did not specify one, so that the user doesn't need + * to say '-cpu help -machine something'. + */ + if (cpu_option && is_help_option(cpu_option)) { + list_cpus(cpu_option); + exit(0); + } + + if (qemu_opts_foreach(qemu_find_opts("device"), + device_help_func, NULL, NULL)) { + exit(0); + } + user_register_global_props(); =20 replay_configure(icount_opts); @@ -3877,11 +3893,6 @@ void qemu_init(int argc, char **argv, char **envp) qemu_set_hw_version(machine_class->hw_version); } =20 - if (cpu_option && is_help_option(cpu_option)) { - list_cpus(cpu_option); - exit(0); - } - if (!trace_init_backends()) { exit(1); } @@ -4112,11 +4123,6 @@ void qemu_init(int argc, char **argv, char **envp) fsdev_init_func, NULL, &error_fatal); #endif =20 - if (qemu_opts_foreach(qemu_find_opts("device"), - device_help_func, NULL, NULL)) { - exit(0); - } - /* * Note: we need to create block backends before * machine_set_property(), so machine properties can refer to --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395678; cv=none; d=zohomail.com; s=zohoarc; b=O+XrXZtf+A2BM6d2XNNlaRH8Zq5LBTlHVg2078+gBbqJDsCeO4U5F4w+p8QQV46dp0/jZKJyrYFloc5MAxzIKuZQEfFPQ3TO015rB8obuXCYIohu/jVRzYW/65zBMarNMmBk8Peixapug5yLBn5NsheqA+oPoGObGG2OTftH2A4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395678; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=xKYQroT23jMsitGoxPZlSc59fsUSsrMk/phQvxBNmAo=; b=ZAQIi5zuM+IEo6G6HYA6OWOfILfrFwUwAaK0HjqiOPnFzIlvHR0BRh95fiLg3/xQoB9+Ruj+bYEru1k0k1ufvrYGWW1M0BVzmlJqyHYxRn6ffUgtik68gm+r/vTRzFjEo/6e5wQ6j8SuJN6OHPBcUiEsY0g93E3nqr9dM6YWN7Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395678625368.3687630873753; Mon, 16 Mar 2020 14:54:38 -0700 (PDT) Received: from localhost ([::1]:49588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxgz-0008Lr-IE for importer@patchew.org; Mon, 16 Mar 2020 17:54:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42741) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHq-00043p-8T for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHo-00067F-15 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:37 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:46327) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHn-00064j-Ry for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:35 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-4qczhLZ4OMKbu1OZiaAI4A-1; Mon, 16 Mar 2020 17:28:33 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 97DFA800D50 for ; Mon, 16 Mar 2020 21:28:32 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A43D619C4F; Mon, 16 Mar 2020 21:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394115; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xKYQroT23jMsitGoxPZlSc59fsUSsrMk/phQvxBNmAo=; b=iUyTnoidDp52c33YkswfNx5D/r8J/TQTC2ip+87/NDxh6sfghu2Y8YdhwqTibjK3YrZdBC vh///QT33/zMCuT4y5Wt6CCPznUTy1sdet21VjgGNrRFo/nIZ9CdzPVrVR/4oTbwgGhSII BcMb/S1JNmacYmmW6DN+kaeMtMT8oRo= X-MC-Unique: 4qczhLZ4OMKbu1OZiaAI4A-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 32/61] Use -isystem for linux-headers dir Date: Mon, 16 Mar 2020 22:26:59 +0100 Message-Id: <1584394048-44994-33-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Eduardo Habkost Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Eduardo Habkost glibc and Linux-provided headers are known to generate macro redefinition warnings when used together. For example: and duplicate some macro definitions. We normally never see those warnings because GCC suppresses warnings generated by system headers. We carry our own copy of Linux header files, though, and this makes those warnings not be suppressed when glibc headers are included before Linux headers (e.g. if is included before ). Use -isystem instead of -I for linux-headers. This makes the compiler treat our linux-headers directory the same way it treats system-provided Linux headers, and suppress warnings generated by them. Signed-off-by: Eduardo Habkost Reviewed-by: Michael S. Tsirkin Signed-off-by: Paolo Bonzini --- Makefile.target | 2 +- configure | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.target b/Makefile.target index 2d43dc5..934a9f7 100644 --- a/Makefile.target +++ b/Makefile.target @@ -12,7 +12,7 @@ endif =20 $(call set-vpath, $(SRC_PATH):$(BUILD_DIR)) ifdef CONFIG_LINUX -QEMU_CFLAGS +=3D -I../linux-headers +QEMU_CFLAGS +=3D -isystem ../linux-headers endif QEMU_CFLAGS +=3D -iquote .. -iquote $(SRC_PATH)/target/$(TARGET_BASE_ARCH)= -DNEED_CPU_H =20 diff --git a/configure b/configure index 44a70cf..06fcd07 100755 --- a/configure +++ b/configure @@ -900,7 +900,7 @@ Linux) linux=3D"yes" linux_user=3D"yes" kvm=3D"yes" - QEMU_INCLUDES=3D"-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU= _INCLUDES" + QEMU_INCLUDES=3D"-isystem \$(SRC_PATH)/linux-headers -isystem $PWD/linux= -headers $QEMU_INCLUDES" supported_os=3D"yes" libudev=3D"yes" ;; --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584394945; cv=none; d=zohomail.com; s=zohoarc; b=B3ol3oIXN3E1JYSpqTZ9fbGl88fWVdIpVR6U0KDyN81kuhQKLSwFPa6idf36P7QgmeOccZle2hor65GwXZi+9uu0O8QP70kyRw0SKmENod++/6L43g1ic2RGUqTx7H51OZKIKtvkexblX/jtgedfJ8GuLqk7oaQU7/wK+fiDbXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584394945; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=tag38lhnvG1hJ+kq614FsjPtBK+zW3BKx6L1S1mj9hw=; b=QpbzO8aasQ4+EKBy2IziLuic4HVd46TXUcD5c952n76/bNEYMv2FCxwrfAW/oOsaDAit7Y/TWErbSAnbZRuDhHV3CS4fu6Q0FbFNH8QM8XWaNl/8B0RlInqq1hqWxfXHBs/uTRm0urnqgLxMrrIFBwMtILFyeEBUq40a4PmOwbQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584394945609756.112065258447; Mon, 16 Mar 2020 14:42:25 -0700 (PDT) Received: from localhost ([::1]:49426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxVA-0005SE-Ip for importer@patchew.org; Mon, 16 Mar 2020 17:42:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42805) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHv-00045t-Dd for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHs-0006Lt-1s for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:41 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:48671) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHq-0006E0-6d for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:39 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-148-AezbGN8wMjuQcjRhvaV06A-1; Mon, 16 Mar 2020 17:28:34 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F41221085925 for ; Mon, 16 Mar 2020 21:28:33 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C9FA19C4F; Mon, 16 Mar 2020 21:28:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394116; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tag38lhnvG1hJ+kq614FsjPtBK+zW3BKx6L1S1mj9hw=; b=WoEEGg6af+E93BPoW0MPalrDHRnWUJgjV+jSy50SDOa/7xCsDDY4t6JIOWj0hsqQS/K82K 9WJOazF8E6AmufQHc7QWwY6Fr1SkttmWSw7Zx/TJzyCS/HEP99iDCMMRXrzDeGaCIHmEnX P809C0jynpk5Ju0ByYpdXWE0MKMLRPw= X-MC-Unique: AezbGN8wMjuQcjRhvaV06A-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 33/61] exec/rom_reset: Free rom data during inmigrate skip Date: Mon, 16 Mar 2020 22:27:00 +0100 Message-Id: <1584394048-44994-34-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Commit 355477f8c73e9 skips rom reset when we're an incoming migration so as not to overwrite shared ram in the ignore-shared migration optimisation. However, it's got an unexpected side effect that because it skips freeing the ROM data, when rom_reset gets called later on, after migration (e.g. during a reboot), the ROM does get reset to the original file contents. Because of seabios/x86's weird reboot process this confuses a reboot into hanging after a migration. Fixes: 355477f8c73e9 ("migration: do not rom_reset() during incoming migrat= ion") https://bugzilla.redhat.com/show_bug.cgi?id=3D1809380 Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Peter Maydell Signed-off-by: Paolo Bonzini --- hw/core/loader.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/hw/core/loader.c b/hw/core/loader.c index d1b78f6..eeef6da 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -1119,19 +1119,26 @@ static void rom_reset(void *unused) { Rom *rom; =20 - /* - * We don't need to fill in the RAM with ROM data because we'll fill - * the data in during the next incoming migration in all cases. Note - * that some of those RAMs can actually be modified by the guest on ARM - * so this is probably the only right thing to do here. - */ - if (runstate_check(RUN_STATE_INMIGRATE)) - return; - QTAILQ_FOREACH(rom, &roms, next) { if (rom->fw_file) { continue; } + /* + * We don't need to fill in the RAM with ROM data because we'll fi= ll + * the data in during the next incoming migration in all cases. N= ote + * that some of those RAMs can actually be modified by the guest. + */ + if (runstate_check(RUN_STATE_INMIGRATE)) { + if (rom->data && rom->isrom) { + /* + * Free it so that a rom_reset after migration doesn't + * overwrite a potentially modified 'rom'. + */ + rom_free_data(rom); + } + continue; + } + if (rom->data =3D=3D NULL) { continue; } --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395053; cv=none; d=zohomail.com; s=zohoarc; b=IXvqJMISNR+XCIVL+E32pM1WeWksD4Z1qP1fx06YGq77ssLCHwx6lktBouUn6GSENwW+/TXRMfIoaJmUIQuyofWLjPWdWwDKBS5WfwTB4TeA5M+M7ocBkkRJfJBjQmtYZmWIB2SP0nFgy89WeUnOH+0OC0uvqG/S2AQOOm4/1Sc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395053; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=MKUYLYyTOhXXs5Uuzx/QroEWqaITGSQKhJNLF3Ips9U=; b=YVP9kY5OBb02r+3nIl+fhjmrOzE2nAyuNFKnhN1MWmHsdkyB2j2hpynAB95FPsbm029TWhpxykwSVtAbQWQIuUdmgaaOCp0wnFkVxqRY5mJM8WH5+1cm92p/zj/5q4qfoc+e0F/947BDfgeZOzdvrrYELWiu+Td4h8fPETjfM28= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 158439505311088.6054902013941; Mon, 16 Mar 2020 14:44:13 -0700 (PDT) Received: from localhost ([::1]:49450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxWu-0000na-2D for importer@patchew.org; Mon, 16 Mar 2020 17:44:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42852) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHx-00047t-SU for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHv-0006Rg-Rt for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:45 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:54083) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHt-0006NH-SA for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:42 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-366-ttNj0ZWuMJi1nOUxPOGdIw-1; Mon, 16 Mar 2020 17:28:37 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B16598017CC; Mon, 16 Mar 2020 21:28:36 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6997119C4F; Mon, 16 Mar 2020 21:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MKUYLYyTOhXXs5Uuzx/QroEWqaITGSQKhJNLF3Ips9U=; b=KEDCtUzS5ZUidBlkAoo0d6SomGztodjYJnjtsnPibv8LsuDISx+5qWu15p9sOOUL2uFLff nTEAUMyX7yEdICml7cMBSOCLq6T0oiTOBgagD4g0CiNYDtj4j8ph6I4RASwR+33ihWFQkm SydinnG5ZI+eg50A8mV4QKMtDSFcNPo= X-MC-Unique: ttNj0ZWuMJi1nOUxPOGdIw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 34/61] cpus: avoid pause_all_vcpus getting stuck due to race Date: Mon, 16 Mar 2020 22:27:01 +0100 Message-Id: <1584394048-44994-35-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Longpeng , "Dr. David Alan Gilbert" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Longpeng We found an issue when repeat reboot in guest during migration, it cause the migration thread never be waken up again.
| | LOCK BQL | ... | main_loop_should_exit | pause_all_vcpus | 1. set all cpus ->stop=3Dtrue | and then kick | 2. return if all cpus is paused | (by '->stopped =3D=3D true'), else| 3. qemu_cond_wait [BQL UNLOCK] | |LOCK BQL |... |do_vm_stop | pause_all_vcpus | (A)set all cpus ->stop=3Dtrue | and then kick | (B)return if all cpus is paused | (by '->stopped =3D=3D true'), else | (C)qemu_cond_wait [BQL UNLOCK] 4. be waken up and LOCK BQL | (D)be waken up BUT wait for BQL 5. goto 2. | (BQL is still LOCKed) | resume_all_vcpus | 1. set all cpus ->stop=3Dfalse | and ->stopped=3Dfalse | ... | BQL UNLOCK | (E)LOCK BQL | (F)goto B. [but stopped is false now!] |Finally, sleep at step 3 forever. resume_all_vcpus should notice this race, so we need to move the change of runstate before pause_all_vcpus in do_vm_stop() and ignore the resume request if runstate is not running. Cc: Dr. David Alan Gilbert Cc: Richard Henderson Signed-off-by: Longpeng Suggested-by: Paolo Bonzini Message-Id: <20200316083732.2010-1-longpeng2@huawei.com> Signed-off-by: Paolo Bonzini --- cpus.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index b4f8b84..ef441bd 100644 --- a/cpus.c +++ b/cpus.c @@ -1026,9 +1026,9 @@ static int do_vm_stop(RunState state, bool send_stop) int ret =3D 0; =20 if (runstate_is_running()) { + runstate_set(state); cpu_disable_ticks(); pause_all_vcpus(); - runstate_set(state); vm_state_notify(0, state); if (send_stop) { qapi_event_send_stop(); @@ -1899,6 +1899,10 @@ void resume_all_vcpus(void) { CPUState *cpu; =20 + if (!runstate_is_running()) { + return; + } + qemu_clock_enable(QEMU_CLOCK_VIRTUAL, true); CPU_FOREACH(cpu) { cpu_resume(cpu); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395433; cv=none; d=zohomail.com; s=zohoarc; b=ni5BHQ//sWbSzEZAPOzyz73yjRZ0sJSgJAXq3eW+EF2QPusSttxMLXchH1zEDWmU1gj0rBNIPc6QZx7pep2KlRE/ty+FOi8oRVhzzuHxtPWh7gEeP377t4iPNge8eANeDpJglh97zOmlQHRRHqpeEFIOrHEuoloIMHFlPo0h9Ds= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395433; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=fIaAJM7KMXJNIIdCPNvdGaGIRTIPdfuccqzByHYxV1c=; b=m0S2SJ760ucvJvtHMVrgIEVNnp0J3PZrHLb9nvOCN0tRRpFHA2HtCfUO7kNCALsPW3lCUAiIfmHzbQ840+r9Jbvc4JIXnCN0Y4njTITvVhNDXBHz0r5mBswCgU5fLw1L6s69WEHHC84aeVKazf8k0uSi/v9Sa+GaIkFGcZX63No= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395433223315.5932673038084; Mon, 16 Mar 2020 14:50:33 -0700 (PDT) Received: from localhost ([::1]:49538 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxd2-0001dD-2v for importer@patchew.org; Mon, 16 Mar 2020 17:50:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42972) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI4-0004C6-Bq for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI2-0006cb-Ld for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:52 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:36919) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHz-0006Yk-TY for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229--qIl5VHyNZm5xmtNQNze1g-1; Mon, 16 Mar 2020 17:28:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A0EE3100550E for ; Mon, 16 Mar 2020 21:28:40 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 267DF3A7; Mon, 16 Mar 2020 21:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fIaAJM7KMXJNIIdCPNvdGaGIRTIPdfuccqzByHYxV1c=; b=CiDiV8/CjifsXZTfyaG/025Qfsq4lNh0yuBB6lEKH9dCrRlydGSTUlLvTVAtIZhLzWgL5V isC01YICfBU3Paz1A3s2pdA6dVb+Wx1AFNpDeXdEz7235d6n0GvsTp+HNqC4aVH6cpeRI4 nTTcPofPUd4AuBJuje/tihiOKpsS3Pc= X-MC-Unique: -qIl5VHyNZm5xmtNQNze1g-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 35/61] lockable: add lock guards Date: Mon, 16 Mar 2020 22:27:02 +0100 Message-Id: <1584394048-44994-36-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Hajnoczi This patch introduces two lock guard macros that automatically unlock a lock object (QemuMutex and others): void f(void) { QEMU_LOCK_GUARD(&mutex); if (!may_fail()) { return; /* automatically unlocks mutex */ } ... } and: WITH_QEMU_LOCK_GUARD(&mutex) { if (!may_fail()) { return; /* automatically unlocks mutex */ } } /* automatically unlocks mutex here */ ... Convert qemu-timer.c functions that benefit from these macros as an example. Manual qemu_mutex_lock/unlock() callers are left unmodified in cases where clarity would not improve by switching to the macros. Many other QemuMutex users remain in the codebase that might benefit from lock guards. Over time they can be converted, if that is desirable. Signed-off-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- include/qemu/lockable.h | 65 +++++++++++++++++++++++++++++++++++++++++++++= ++++ util/qemu-timer.c | 23 +++++++++-------- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h index 84ea794..2b52c7c 100644 --- a/include/qemu/lockable.h +++ b/include/qemu/lockable.h @@ -93,4 +93,69 @@ static inline void qemu_lockable_unlock(QemuLockable *x) x->unlock(x->object); } =20 +static inline QemuLockable *qemu_lockable_auto_lock(QemuLockable *x) +{ + qemu_lockable_lock(x); + return x; +} + +static inline void qemu_lockable_auto_unlock(QemuLockable *x) +{ + if (x) { + qemu_lockable_unlock(x); + } +} + +G_DEFINE_AUTOPTR_CLEANUP_FUNC(QemuLockable, qemu_lockable_auto_unlock) + +#define WITH_QEMU_LOCK_GUARD_(x, var) \ + for (g_autoptr(QemuLockable) var =3D \ + qemu_lockable_auto_lock(QEMU_MAKE_LOCKABLE((x))); \ + var; \ + qemu_lockable_auto_unlock(var), var =3D NULL) + +/** + * WITH_QEMU_LOCK_GUARD - Lock a lock object for scope + * + * @x: a lock object (currently one of QemuMutex, CoMutex, QemuSpin). + * + * This macro defines a lock scope such that entering the scope takes the = lock + * and leaving the scope releases the lock. Return statements are allowed + * within the scope and release the lock. Break and continue statements l= eave + * the scope early and release the lock. + * + * WITH_QEMU_LOCK_GUARD(&mutex) { + * ... + * if (error) { + * return; <-- mutex is automatically unlocked + * } + * + * if (early_exit) { + * break; <-- leave this scope early + * } + * ... + * } + */ +#define WITH_QEMU_LOCK_GUARD(x) \ + WITH_QEMU_LOCK_GUARD_((x), qemu_lockable_auto##__COUNTER__) + +/** + * QEMU_LOCK_GUARD - Lock an object until the end of the scope + * + * @x: a lock object (currently one of QemuMutex, CoMutex, QemuSpin). + * + * This macro takes a lock until the end of the scope. Return statements + * release the lock. + * + * ... <-- mutex not locked + * QEMU_LOCK_GUARD(&mutex); <-- mutex locked from here onwards + * ... + * if (error) { + * return; <-- mutex is automatically unlocked + * } + */ +#define QEMU_LOCK_GUARD(x) \ + g_autoptr(QemuLockable) qemu_lockable_auto##__COUNTER__ =3D \ + qemu_lockable_auto_lock(QEMU_MAKE_LOCKABLE((x))) + #endif diff --git a/util/qemu-timer.c b/util/qemu-timer.c index ef52d28..d548d3c 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu/main-loop.h" #include "qemu/timer.h" +#include "qemu/lockable.h" #include "sysemu/replay.h" #include "sysemu/cpus.h" =20 @@ -186,13 +187,12 @@ bool timerlist_expired(QEMUTimerList *timer_list) return false; } =20 - qemu_mutex_lock(&timer_list->active_timers_lock); - if (!timer_list->active_timers) { - qemu_mutex_unlock(&timer_list->active_timers_lock); - return false; + WITH_QEMU_LOCK_GUARD(&timer_list->active_timers_lock) { + if (!timer_list->active_timers) { + return false; + } + expire_time =3D timer_list->active_timers->expire_time; } - expire_time =3D timer_list->active_timers->expire_time; - qemu_mutex_unlock(&timer_list->active_timers_lock); =20 return expire_time <=3D qemu_clock_get_ns(timer_list->clock->type); } @@ -225,13 +225,12 @@ int64_t timerlist_deadline_ns(QEMUTimerList *timer_li= st) * value but ->notify_cb() is called when the deadline changes. There= fore * the caller should notice the change and there is no race condition. */ - qemu_mutex_lock(&timer_list->active_timers_lock); - if (!timer_list->active_timers) { - qemu_mutex_unlock(&timer_list->active_timers_lock); - return -1; + WITH_QEMU_LOCK_GUARD(&timer_list->active_timers_lock) { + if (!timer_list->active_timers) { + return -1; + } + expire_time =3D timer_list->active_timers->expire_time; } - expire_time =3D timer_list->active_timers->expire_time; - qemu_mutex_unlock(&timer_list->active_timers_lock); =20 delta =3D expire_time - qemu_clock_get_ns(timer_list->clock->type); =20 --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395149; cv=none; d=zohomail.com; s=zohoarc; b=VLgNHFVfGziII9sBRTxB+QlEnXceF3eUD8bZMD6oaRElrbnrzeF/sB5Q5HpkOc5ic9wT+Ocxc1JZxwd1QJYAJq5GSsXTy1Vv3gEkEkz6hKOj50FsOE+kAfhjtKpzH/ixRwv/vnoyegP5UEcWRMAB+yqzgsLjAUB7DnXP5SaISXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395149; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dEPVzIMyMWMKB/q/1uEhyznN7dRLW8w5wO1zuVp/Uhk=; b=F/1be8Mfd/7dcNiuFFB3Y0Wa71fBEHC5z380faEZo6FP3oKPgYj1+lFN14+18gHIfDTDhTx0RQEdWqnQHOry7iySFXTMd7C4itZmUyza02zoqj9s8eU4iBbMouvSAGl8SsROlGIeYEpg5p7S8ZbdTmj7aW6iZx1JxbPmAIcGjog= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395149740150.62870659181362; Mon, 16 Mar 2020 14:45:49 -0700 (PDT) Received: from localhost ([::1]:49478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxYR-0002uc-9A for importer@patchew.org; Mon, 16 Mar 2020 17:45:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42883) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxHz-00048l-PV for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHx-0006Wx-Va for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:47 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:39569) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHx-0006VJ-Py for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:45 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-60-zfjTpfouNUeThZK4NlgKWA-1; Mon, 16 Mar 2020 17:28:42 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0CFF3800D53 for ; Mon, 16 Mar 2020 21:28:42 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15FCB19C4F; Mon, 16 Mar 2020 21:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dEPVzIMyMWMKB/q/1uEhyznN7dRLW8w5wO1zuVp/Uhk=; b=KGV8WTinssBFmn7NAsVTRe7Db/zliQqjElw8JupbWIlCD6s4Vjcl+NyFv5BwO+XEGz1DfJ OEZjQL86uNEnhQge3L34vQinTLRv4qpCbj1O2KQUuSagCv3iLCJ8LH31jzvfXy6o/vbwj2 2BWrvhG13VWrsT0w5PRyD/H2ZH3RYK4= X-MC-Unique: zfjTpfouNUeThZK4NlgKWA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 36/61] lockable: add QemuRecMutex support Date: Mon, 16 Mar 2020 22:27:03 +0100 Message-Id: <1584394048-44994-37-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: Stefan Hajnoczi Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stefan Hajnoczi The polymorphic locking macros don't support QemuRecMutex yet. Add it so that lock guards can be used with QemuRecMutex. Convert TCG plugins functions that benefit from these macros. Manual qemu_rec_mutex_lock/unlock() callers are left unmodified in cases where clarity would not improve by switching to the macros. Signed-off-by: Stefan Hajnoczi Signed-off-by: Paolo Bonzini --- include/qemu/lockable.h | 2 ++ plugins/core.c | 7 +++---- plugins/loader.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/include/qemu/lockable.h b/include/qemu/lockable.h index 2b52c7c..44b3f4b 100644 --- a/include/qemu/lockable.h +++ b/include/qemu/lockable.h @@ -50,6 +50,7 @@ qemu_make_lockable(void *x, QemuLockable *lockable) #define QEMU_LOCK_FUNC(x) ((QemuLockUnlockFunc *) \ QEMU_GENERIC(x, \ (QemuMutex *, qemu_mutex_lock), \ + (QemuRecMutex *, qemu_rec_mutex_lock), \ (CoMutex *, qemu_co_mutex_lock), \ (QemuSpin *, qemu_spin_lock), \ unknown_lock_type)) @@ -57,6 +58,7 @@ qemu_make_lockable(void *x, QemuLockable *lockable) #define QEMU_UNLOCK_FUNC(x) ((QemuLockUnlockFunc *) \ QEMU_GENERIC(x, \ (QemuMutex *, qemu_mutex_unlock), \ + (QemuRecMutex *, qemu_rec_mutex_unlock), \ (CoMutex *, qemu_co_mutex_unlock), \ (QemuSpin *, qemu_spin_unlock), \ unknown_lock_type)) diff --git a/plugins/core.c b/plugins/core.c index ed86301..51bfc94 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -15,6 +15,7 @@ #include "qemu/error-report.h" #include "qemu/config-file.h" #include "qapi/error.h" +#include "qemu/lockable.h" #include "qemu/option.h" #include "qemu/rcu_queue.h" #include "qemu/xxhash.h" @@ -150,11 +151,11 @@ do_plugin_register_cb(qemu_plugin_id_t id, enum qemu_= plugin_event ev, { struct qemu_plugin_ctx *ctx; =20 - qemu_rec_mutex_lock(&plugin.lock); + QEMU_LOCK_GUARD(&plugin.lock); ctx =3D plugin_id_to_ctx_locked(id); /* if the plugin is on its way out, ignore this request */ if (unlikely(ctx->uninstalling)) { - goto out_unlock; + return; } if (func) { struct qemu_plugin_cb *cb =3D ctx->callbacks[ev]; @@ -178,8 +179,6 @@ do_plugin_register_cb(qemu_plugin_id_t id, enum qemu_pl= ugin_event ev, } else { plugin_unregister_cb__locked(ctx, ev); } - out_unlock: - qemu_rec_mutex_unlock(&plugin.lock); } =20 void plugin_register_cb(qemu_plugin_id_t id, enum qemu_plugin_event ev, diff --git a/plugins/loader.c b/plugins/loader.c index 15fc7e5..685d334 100644 --- a/plugins/loader.c +++ b/plugins/loader.c @@ -19,6 +19,7 @@ #include "qemu/error-report.h" #include "qemu/config-file.h" #include "qapi/error.h" +#include "qemu/lockable.h" #include "qemu/option.h" #include "qemu/rcu_queue.h" #include "qemu/qht.h" @@ -367,15 +368,14 @@ void plugin_reset_uninstall(qemu_plugin_id_t id, struct qemu_plugin_reset_data *data; struct qemu_plugin_ctx *ctx; =20 - qemu_rec_mutex_lock(&plugin.lock); - ctx =3D plugin_id_to_ctx_locked(id); - if (ctx->uninstalling || (reset && ctx->resetting)) { - qemu_rec_mutex_unlock(&plugin.lock); - return; + WITH_QEMU_LOCK_GUARD(&plugin.lock) { + ctx =3D plugin_id_to_ctx_locked(id); + if (ctx->uninstalling || (reset && ctx->resetting)) { + return; + } + ctx->resetting =3D reset; + ctx->uninstalling =3D !reset; } - ctx->resetting =3D reset; - ctx->uninstalling =3D !reset; - qemu_rec_mutex_unlock(&plugin.lock); =20 data =3D g_new(struct qemu_plugin_reset_data, 1); data->ctx =3D ctx; --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395630; cv=none; d=zohomail.com; s=zohoarc; b=H/NPHcnY3xsquD7uSoRf2mrRaQ3MxY5covuJn7et3WPBbS5LCNl8TMusHc21aqoTV9Uktfp8hNHr4S0K/Dll8DZkkcMwzYQlQQtdIPdMzAMBIyymIz4Pj9iGBis4kVok04sJzh7rQZ5t0g345uWfv2sqpup7+k0rdMnLLyoUEmw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395630; 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=ur/zmMARIrQuuY6HJw2Bi9jYsYGLyjEYoDKJV5fir9Q=; b=hXufT+yv29A8rDJTV69m467xQPqW2X2fdg0F8rbjdIapizxefe9fbaY5HDo+CQBGxHBoaOwyrlE0w70Np3HdshsSEplZdhKPI9UINVf8V9+ud9qbjQADs2gf6qXLDWZdForCjSPtySgGa8aGIZvtpidxX+9a4G+XOTKQ/eL8QsU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395630000469.05697867724757; Mon, 16 Mar 2020 14:53:50 -0700 (PDT) Received: from localhost ([::1]:49580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxgD-0006mT-01 for importer@patchew.org; Mon, 16 Mar 2020 17:53:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42920) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI2-00049R-M1 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxHz-0006ZY-Qy for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:49 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:52110) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHz-0006XC-Cn for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:47 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-403-TPDEzqDkMyCd1K30aZxVuA-1; Mon, 16 Mar 2020 17:28:44 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 65F588017DF for ; Mon, 16 Mar 2020 21:28:43 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 73D4619C4F; Mon, 16 Mar 2020 21:28:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394125; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ur/zmMARIrQuuY6HJw2Bi9jYsYGLyjEYoDKJV5fir9Q=; b=K0I+kirVP+AqO6gAr4+gb0ZlCd51vuI4/Ov13FxltBL4Q2XIhBaQhcoDX74Adh0YkwjA/+ huOHBZhOf83/gIWRin2ntDuIRzvzRwG6kMgIwQnkFEbBg8HFBMeo3cMFL1a0KllTm0nDyZ 4WX5OTVgJ/mOa4qUhSRRF1SIUHEzGG8= X-MC-Unique: TPDEzqDkMyCd1K30aZxVuA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 37/61] memory: Correctly return alias region type Date: Mon, 16 Mar 2020 22:27:04 +0100 Message-Id: <1584394048-44994-38-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Since memory region aliases are neither rom nor ram, they are described as i/o, which is often incorrect. Return instead the type of the original region we are aliasing. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- memory.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/memory.c b/memory.c index 404ff4e..fc99e7f 100644 --- a/memory.c +++ b/memory.c @@ -2819,6 +2819,9 @@ void address_space_destroy(AddressSpace *as) =20 static const char *memory_region_type(MemoryRegion *mr) { + if (mr->alias) { + return memory_region_type(mr->alias); + } if (memory_region_is_ram_device(mr)) { return "ramd"; } else if (memory_region_is_romd(mr)) { --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395293; cv=none; d=zohomail.com; s=zohoarc; b=UpbH0gfLQLqxB62WWzSn1/s1tKdqZyIh3C+cFFG/Ke3ooibtkTaBEoKdxIEeNFko0roY7PZwRHzjNnvwytC+TZ6XC+SMk8N5E4RWeekRcCLQaYty7/27w3BmpbgG4wFN0uwOiiB7CXosWbevVbuuwt8mQOp7tyRpv1lGexFTg3I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395293; 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=c1gqwyrhhUDlVOZSvXf5i//uCOtTQ1q3OAyZCXsNszo=; b=hmyJBmvXlWbZLTFjBLEDsrDZuNFi9SkzfnlycXIsHP9ffL9d4oCGKwinmmJEbCZSKYKw8B+TqUC170bnhLqO63f2gG0B/3kaYQuVk/EVNBdrScMsk7arm+XWOxXLhz3wbpqpukI6+cGJ+5FMjLW6CbPl8zstbckvWmCT5OtRM7A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395293758361.22990945472884; Mon, 16 Mar 2020 14:48:13 -0700 (PDT) Received: from localhost ([::1]:49512 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxam-0006gs-FW for importer@patchew.org; Mon, 16 Mar 2020 17:48:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42952) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI3-0004As-Hq for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI2-0006cE-Fb for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:51 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:43638) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxHz-0006YR-Pe for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:48 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-288-ngfRpbgxO0OWlQUqwn92wQ-1; Mon, 16 Mar 2020 17:28:45 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5530800D50 for ; Mon, 16 Mar 2020 21:28:44 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFF7219C4F; Mon, 16 Mar 2020 21:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=c1gqwyrhhUDlVOZSvXf5i//uCOtTQ1q3OAyZCXsNszo=; b=GUhV6IhnUqAqHC7wKK1muq/zNFBUR2IYTUbw04/4eCSIkDVODMihv36bc4pDsPYmkp8MuH TpxKOmrRcdaOSlVcQoXtlrejypa7nGB1N/2hVy/b/9ecOERkj5VjSRQznnn9Fc6s4nXb2n Fj4W2fDi0fRs+QtAC5HF448a3RzQwQs= X-MC-Unique: ngfRpbgxO0OWlQUqwn92wQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 38/61] memory: Simplify memory_region_init_rom_nomigrate() to ease review Date: Mon, 16 Mar 2020 22:27:05 +0100 Message-Id: <1584394048-44994-39-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 memory_region_init_rom_nomigrate() has the same content than memory_region_init_ram_shared_nomigrate(), with setting the readonly mode. The code is easier to review as creating a readonly ram/shared/nomigrate region. Reviewed-by: Alistair Francis Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- memory.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/memory.c b/memory.c index fc99e7f..601b749 100644 --- a/memory.c +++ b/memory.c @@ -1660,19 +1660,8 @@ void memory_region_init_rom_nomigrate(MemoryRegion *= mr, uint64_t size, Error **errp) { - Error *err =3D NULL; - memory_region_init(mr, owner, name, size); - mr->ram =3D true; + memory_region_init_ram_shared_nomigrate(mr, owner, name, size, false, = errp); mr->readonly =3D true; - mr->terminates =3D true; - mr->destructor =3D memory_region_destructor_ram; - mr->ram_block =3D qemu_ram_alloc(size, false, mr, &err); - mr->dirty_log_mask =3D tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; - if (err) { - mr->size =3D int128_zero(); - object_unparent(OBJECT(mr)); - error_propagate(errp, err); - } } =20 void memory_region_init_rom_device_nomigrate(MemoryRegion *mr, --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395752; cv=none; d=zohomail.com; s=zohoarc; b=nDnmeiHQlDI8LEyoLaBOn42uPMHucqP+qAEuYS1vXDRE+v6bJP+FDtKZUWiM+idtNErbM/dBqpxlt9IL/C/q3GH+4QVunUOYOmhmyl3AXBzOu99L5tbQ7uAOHzyQfxXyJxqP2zRtjLElzb4fWHMqaF2N0PWAt/k28hI0V5LDFHA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395752; 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=anav/LjQ1m13mmdq5/IzM5jXbq6Z9U2/QX5HlDThZP4=; b=A2ktDZUFQJw3LK6aELSD4wZDAzctzUUQ+IT9F0aT2vljw4oAx5xr2gOtltwi7MYYJ7w6ny1a6YNg+tXL2mvbSgtIh4TMv72VJUoDy9QeTLQzL6BWV+hIMkZLfApdwzS9C39NR0/IdeaLy07CCRsTAipa4/AiG0+o8zDHN9yw5pQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395752518679.4614814328698; Mon, 16 Mar 2020 14:55:52 -0700 (PDT) Received: from localhost ([::1]:49616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxiB-0002DM-Cx for importer@patchew.org; Mon, 16 Mar 2020 17:55:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42970) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI4-0004C4-B9 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI3-0006dG-22 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:52 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:20689) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI1-0006b7-Ji for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:50 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-13-uyVd_ruZOaCWH-kuWwQLVA-1; Mon, 16 Mar 2020 17:28:47 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C2498017DF for ; Mon, 16 Mar 2020 21:28:46 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A94519C4F; Mon, 16 Mar 2020 21:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394128; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=anav/LjQ1m13mmdq5/IzM5jXbq6Z9U2/QX5HlDThZP4=; b=Mhh3XlKOCgiWugm95B5W4aUbSuyzuGgGF/NrFJ4wKd/7/2fdytUDh4HIyiOUNfdrfzoZkP LOKHGc71Tr2djBEJOKMNkGY0e64DrNGFiYOoBXS8+JTYmTwP1TnJa/T4enTU6i8VNbY9Bw Bah1y7oh9LBHRzmmJxm7LWraPhz2Wzk= X-MC-Unique: uyVd_ruZOaCWH-kuWwQLVA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 39/61] scripts/cocci: Rename memory-region-{init-ram -> housekeeping} Date: Mon, 16 Mar 2020 22:27:06 +0100 Message-Id: <1584394048-44994-40-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 As we are going to add various semantic changes related to the memory region API, rename this script to be more generic. Add a 'usage' header, and an entry in MAINTAINERS to avoid checkpatch warning. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 + ...gion-init-ram.cocci =3D> memory-region-housekeeping.cocci} | 13 +++++++= ++++++ 2 files changed, 14 insertions(+) rename scripts/coccinelle/{memory-region-init-ram.cocci =3D> memory-region= -housekeeping.cocci} (84%) diff --git a/MAINTAINERS b/MAINTAINERS index a88bc28..770126f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2047,6 +2047,7 @@ F: include/exec/ramblock.h F: memory.c F: include/exec/memory-internal.h F: exec.c +F: scripts/coccinelle/memory-region-housekeeping.cocci =20 SPICE M: Gerd Hoffmann diff --git a/scripts/coccinelle/memory-region-init-ram.cocci b/scripts/cocc= inelle/memory-region-housekeeping.cocci similarity index 84% rename from scripts/coccinelle/memory-region-init-ram.cocci rename to scripts/coccinelle/memory-region-housekeeping.cocci index d290150..3699c10 100644 --- a/scripts/coccinelle/memory-region-init-ram.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -1,3 +1,16 @@ +/* + Usage: + + spatch \ + --macro-file scripts/cocci-macro-file.h \ + --sp-file scripts/coccinelle/memory-region-housekeeping.cocci \ + --keep-comments \ + --in-place \ + --dir . + +*/ + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395909; cv=none; d=zohomail.com; s=zohoarc; b=Cw0ccNpN6j3TU6AWRnmjS9sO+ji818+3gJ9N9w2bv69NfdZgjRsHh80E+d9O6co5N8LiJ2NErJNFhPWwoLxmKtyJXslKKJhh3t82Mkq9gRcYAmqXC88XvyaMmCjOXL2CTvMiKU9xASS54mfc1ZFvH96hyip1J7UxxToNmXbK6Fw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395909; 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=7UxUZTeTZnf7+3WJEeoyBup/9/rtCgvnfBTIlesvoLU=; b=MPNIJWCnZRlXlqC8WWJqB8EW4c1uRdaFzTpaPfQcsGR36F+VYiDKLynX47yhY+TVXEVD0c12Tl6Zhfig5cpMOA5cP3IIkGvcpkFj7ONctgkTP2trdma59lu+hcVtStSqYzDjgXuptEQnrwi9e8sbpcfGX7W4tMnukD9c5yCGHH4= 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 1584395909243220.91918861149486; Mon, 16 Mar 2020 14:58:29 -0700 (PDT) Received: from localhost ([::1]:49652 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxki-0007C2-7P for importer@patchew.org; Mon, 16 Mar 2020 17:58:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42971) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI4-0004C5-Bj for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI3-0006eD-4k for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:52 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:28122) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI2-0006bx-L1 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-26-UDMuTZ76P-6zeVYUhvEWzg-1; Mon, 16 Mar 2020 17:28:48 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8ABB6149C3 for ; Mon, 16 Mar 2020 21:28:47 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9665719C4F; Mon, 16 Mar 2020 21:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7UxUZTeTZnf7+3WJEeoyBup/9/rtCgvnfBTIlesvoLU=; b=i3twVPTHM3nc3RAbi93iXA1zaZ43kz5wAlxbpxYAU2FzTxjoFDu+4MN74IRyE1thYCJwGd l3OYnHqHHG3/FN7oGd2SBPNPpOMWK+5stDDDHwKYhyW/rfXUzUQUPngpSu4l73sTuAHkZc TrjyUoi63ARefpKpZSR3YRYycvp6NAg= X-MC-Unique: UDMuTZ76P-6zeVYUhvEWzg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 40/61] scripts/cocci: Patch to replace memory_region_init_{ram, readonly -> rom} Date: Mon, 16 Mar 2020 22:27:07 +0100 Message-Id: <1584394048-44994-41-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Add a semantic patch to replace memory_region_init_ram(readonly) by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- scripts/coccinelle/memory-region-housekeeping.cocci | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 3699c10..ee3923d 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -11,6 +11,24 @@ */ =20 =20 +// Replace memory_region_init_ram(readonly) by memory_region_init_rom() +@@ +expression E1, E2, E3, E4, E5; +symbol true; +@@ +( +- memory_region_init_ram(E1, E2, E3, E4, E5); ++ memory_region_init_rom(E1, E2, E3, E4, E5); + ... WHEN !=3D E1 +- memory_region_set_readonly(E1, true); +| +- memory_region_init_ram_nomigrate(E1, E2, E3, E4, E5); ++ memory_region_init_rom_nomigrate(E1, E2, E3, E4, E5); + ... WHEN !=3D E1 +- memory_region_set_readonly(E1, true); +) + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396039; cv=none; d=zohomail.com; s=zohoarc; b=ARsyU19S4VcNq+rMkg1Qryiqb6urM3XmGPLnLBq6kiZaimzAU2SaI4c/fg0F4aoFtw2uOu5cZQ3oRfs9ARB7AcvMvytJvKcoqMPKAXPo3LuZxJTAzd5AKjpTKoQYt8ra1NW4HqhDWUQdvniFI6lJXArbjlVh4KFTyfz/5gm0eQA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396039; 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=g4xvNCNRSh2yAzQnkNyxfYKq+UdpxRWD7xk18vmDD9o=; b=iY4RqgKG4OgBePmEcg4x5Cwji2mMWqMZKwSdmE+5VzN8FEFkZ/s2M6CBKSxom6EyFhnKJ0w1iSiP5dQDTpPx4yPUB843dx/qWlaMdjqjTTMlierVxR2EWwULg4yOWZtJJLba74nmKcnfaPIb3ji9TGU23+CVl9oHya5gUSOsvz8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396039402401.0957204062413; Mon, 16 Mar 2020 15:00:39 -0700 (PDT) Received: from localhost ([::1]:49682 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxmo-0002a7-9Q for importer@patchew.org; Mon, 16 Mar 2020 18:00:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43028) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI5-0004E9-Sy for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI4-0006ib-8o for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:53 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:47817) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI3-0006gY-Mi for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:51 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-131-WdoFYjETMuyALniruDnSOA-1; Mon, 16 Mar 2020 17:28:49 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E5E4F801E5C for ; Mon, 16 Mar 2020 21:28:48 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id F2F7519C4F; Mon, 16 Mar 2020 21:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394131; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g4xvNCNRSh2yAzQnkNyxfYKq+UdpxRWD7xk18vmDD9o=; b=SSdGJULksco/v0VyEFK5XRZyK6pSvrKpZjUIBsrAh7d1SveuqVe98vy5Lbdf6UUpc3+Hkg CkAppTYy23SgE/0faxuA+WAagDuSyUFQ920TmDWGxXMG9AUATuRKOC4G6sTour5Psj+2Cl ocG9U9nH610QshmcYLo85RM9ZMQjjx0= X-MC-Unique: WdoFYjETMuyALniruDnSOA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 41/61] hw/arm: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:08 +0100 Message-Id: <1584394048-44994-42-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/exynos4210.c | 3 +-- hw/arm/mainstone.c | 3 +-- hw/arm/omap_sx1.c | 6 ++---- hw/arm/palm.c | 3 +-- hw/arm/spitz.c | 3 +-- hw/arm/stellaris.c | 3 +-- hw/arm/tosa.c | 3 +-- 7 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 59a27bd..3af6502 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -311,9 +311,8 @@ static void exynos4210_realize(DeviceState *socdev, Err= or **errp) &s->chipid_mem); =20 /* Internal ROM */ - memory_region_init_ram(&s->irom_mem, NULL, "exynos4210.irom", + memory_region_init_rom(&s->irom_mem, NULL, "exynos4210.irom", EXYNOS4210_IROM_SIZE, &error_fatal); - memory_region_set_readonly(&s->irom_mem, true); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_BASE_ADDR, &s->irom_mem); /* mirror of iROM */ diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c index 1042017..6bc6436 100644 --- a/hw/arm/mainstone.c +++ b/hw/arm/mainstone.c @@ -124,9 +124,8 @@ static void mainstone_common_init(MemoryRegion *address= _space_mem, /* Setup CPU & memory */ mpu =3D pxa270_init(address_space_mem, mainstone_binfo.ram_size, machine->cpu_type); - memory_region_init_ram(rom, NULL, "mainstone.rom", MAINSTONE_ROM, + memory_region_init_rom(rom, NULL, "mainstone.rom", MAINSTONE_ROM, &error_fatal); - memory_region_set_readonly(rom, true); memory_region_add_subregion(address_space_mem, 0, rom); =20 /* There are two 32MiB flash devices on the board */ diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index de5ff44..57829b3 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -131,9 +131,8 @@ static void sx1_init(MachineState *machine, const int v= ersion) mpu =3D omap310_mpu_init(machine->ram, machine->cpu_type); =20 /* External Flash (EMIFS) */ - memory_region_init_ram(flash, NULL, "omap_sx1.flash0-0", flash_size, + memory_region_init_rom(flash, NULL, "omap_sx1.flash0-0", flash_size, &error_fatal); - memory_region_set_readonly(flash, true); memory_region_add_subregion(address_space, OMAP_CS0_BASE, flash); =20 memory_region_init_io(&cs[0], NULL, &static_ops, &cs0val, @@ -167,9 +166,8 @@ static void sx1_init(MachineState *machine, const int v= ersion) if ((version =3D=3D 1) && (dinfo =3D drive_get(IF_PFLASH, 0, fl_idx)) !=3D NULL) { MemoryRegion *flash_1 =3D g_new(MemoryRegion, 1); - memory_region_init_ram(flash_1, NULL, "omap_sx1.flash1-0", + memory_region_init_rom(flash_1, NULL, "omap_sx1.flash1-0", flash1_size, &error_fatal); - memory_region_set_readonly(flash_1, true); memory_region_add_subregion(address_space, OMAP_CS1_BASE, flash_1); =20 memory_region_init_io(&cs[1], NULL, &static_ops, &cs1val, diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 99554bd..97ca105 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -213,9 +213,8 @@ static void palmte_init(MachineState *machine) mpu =3D omap310_mpu_init(machine->ram, machine->cpu_type); =20 /* External Flash (EMIFS) */ - memory_region_init_ram(flash, NULL, "palmte.flash", flash_size, + memory_region_init_rom(flash, NULL, "palmte.flash", flash_size, &error_fatal); - memory_region_set_readonly(flash, true); memory_region_add_subregion(address_space_mem, OMAP_CS0_BASE, flash); =20 memory_region_init_io(&cs[0], NULL, &static_ops, &cs0val, "palmte-cs0", diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c index cbfa693..c28d9b5 100644 --- a/hw/arm/spitz.c +++ b/hw/arm/spitz.c @@ -929,8 +929,7 @@ static void spitz_common_init(MachineState *machine, =20 sl_flash_register(mpu, (model =3D=3D spitz) ? FLASH_128M : FLASH_1024M= ); =20 - memory_region_init_ram(rom, NULL, "spitz.rom", SPITZ_ROM, &error_fatal= ); - memory_region_set_readonly(rom, true); + memory_region_init_rom(rom, NULL, "spitz.rom", SPITZ_ROM, &error_fatal= ); memory_region_add_subregion(address_space_mem, 0, rom); =20 /* Setup peripherals */ diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 221a786..d136ba1 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -1300,9 +1300,8 @@ static void stellaris_init(MachineState *ms, stellari= s_board_info *board) sram_size =3D ((board->dc0 >> 18) + 1) * 1024; =20 /* Flash programming is done via the SCU, so pretend it is ROM. */ - memory_region_init_ram(flash, NULL, "stellaris.flash", flash_size, + memory_region_init_rom(flash, NULL, "stellaris.flash", flash_size, &error_fatal); - memory_region_set_readonly(flash, true); memory_region_add_subregion(system_memory, 0, flash); =20 memory_region_init_ram(sram, NULL, "stellaris.sram", sram_size, diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c index 4d95a1f..5dee2d7 100644 --- a/hw/arm/tosa.c +++ b/hw/arm/tosa.c @@ -226,8 +226,7 @@ static void tosa_init(MachineState *machine) =20 mpu =3D pxa255_init(address_space_mem, tosa_binfo.ram_size); =20 - memory_region_init_ram(rom, NULL, "tosa.rom", TOSA_ROM, &error_fatal); - memory_region_set_readonly(rom, true); + memory_region_init_rom(rom, NULL, "tosa.rom", TOSA_ROM, &error_fatal); memory_region_add_subregion(address_space_mem, 0, rom); =20 tmio =3D tc6393xb_init(address_space_mem, 0x10000000, --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395223; cv=none; d=zohomail.com; s=zohoarc; b=gBqZFu5p0kLZz+5cBoSDkJ1xNsy1TFThNByFmyWlLo1JOCN+vtEvv7o2Vd5GYnVdtbrIoP1zh2R9LI9p9gcZC/q2n2QBfxDCVwxDbbOS9iiFNtsV76MEOXkARaSZWH5CzXMnId4BnwT1L64eXjhud35iueHERqmR3369j4z9KJw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395223; 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=OEXZN7d+6n7gWz53+DQEczdQFDnzAa/V+SlH8NwCP94=; b=JtH5fxwuyJKrhjGEHASfc7SxtWn26bzMhDg59JRrEa8qFG2EhORU0Uw6xrRgRzNaMLcwYl5so/yYfHTEliKlbXwQF1NITbojxwlSwEQBOYOFMHhuEyEbl0i+/ycyjcC++9DOjcH+1Uc078st6qjE531SdXujE7SET/xrzxXoljE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395223280687.4759143327889; Mon, 16 Mar 2020 14:47:03 -0700 (PDT) Received: from localhost ([::1]:49492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxZe-0004ET-8M for importer@patchew.org; Mon, 16 Mar 2020 17:47:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43045) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxI6-0004EM-BY for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI5-0006qf-9Y for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:54 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:23633) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI5-0006od-4u for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:53 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-6Ni7UIzfM-OobxOkwQM8Rw-1; Mon, 16 Mar 2020 17:28:51 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5206A800D53 for ; Mon, 16 Mar 2020 21:28:50 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C40F19C4F; Mon, 16 Mar 2020 21:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394132; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OEXZN7d+6n7gWz53+DQEczdQFDnzAa/V+SlH8NwCP94=; b=Ab1dPlXMzda4nBDcMZEbo7RNtoBr5CClnQW52e+si1LTyE3/HAi4d3IHH9q9lc+vxCyTQ3 EUuSvT3uuqlmvfS/S5HsorQwXkF7E5sov/mJ/uPy03hKpQ5uh3GcPtw5v5nFQAxayZrBvD Ica362OIoypfSv8X7Q7SmI4zCk53zc8= X-MC-Unique: 6Ni7UIzfM-OobxOkwQM8Rw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 42/61] hw/display: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:09 +0100 Message-Id: <1584394048-44994-43-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/cg3.c | 5 ++--- hw/display/tcx.c | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hw/display/cg3.c b/hw/display/cg3.c index 4fb67c6..a1ede10 100644 --- a/hw/display/cg3.c +++ b/hw/display/cg3.c @@ -287,9 +287,8 @@ static void cg3_initfn(Object *obj) SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); CG3State *s =3D CG3(obj); =20 - memory_region_init_ram_nomigrate(&s->rom, obj, "cg3.prom", FCODE_MAX_R= OM_SIZE, - &error_fatal); - memory_region_set_readonly(&s->rom, true); + memory_region_init_rom_nomigrate(&s->rom, obj, "cg3.prom", + FCODE_MAX_ROM_SIZE, &error_fatal); sysbus_init_mmio(sbd, &s->rom); =20 memory_region_init_io(&s->reg, obj, &cg3_reg_ops, s, "cg3.reg", diff --git a/hw/display/tcx.c b/hw/display/tcx.c index ca458f9..76de16e 100644 --- a/hw/display/tcx.c +++ b/hw/display/tcx.c @@ -755,9 +755,8 @@ static void tcx_initfn(Object *obj) SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); TCXState *s =3D TCX(obj); =20 - memory_region_init_ram_nomigrate(&s->rom, obj, "tcx.prom", FCODE_MAX_R= OM_SIZE, - &error_fatal); - memory_region_set_readonly(&s->rom, true); + memory_region_init_rom_nomigrate(&s->rom, obj, "tcx.prom", + FCODE_MAX_ROM_SIZE, &error_fatal); sysbus_init_mmio(sbd, &s->rom); =20 /* 2/STIP : Stippler */ --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395583; cv=none; d=zohomail.com; s=zohoarc; b=friPLKJgYxWSB92N/I2PM7NbwwOR4+CYa21Byt3Lq+7ZsndMjC2TmZHRaKQOP4sM/o4OrOCX3Au/+fbRGsWjgqsmMsrqvLH1B9bbarKNrb5Q5QJMEF1zYYA4DN32PGSbJBET1FamXZr1CX+2e+tDeHDWR2kxtvO65jABCIx34E4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395583; 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=+B+CdBtdT91xG48LJ61qZJLTftidDcyWk+tCWm4HNZ4=; b=JtsxI6WTB5eJ89IX4RL7lKPlrZdTu7S5NsD0b7DmPfOo2SVTxyMw17yuClBMVjRNYQnGPPFlF5TYcsK3TIJkRA7vvNtyghe9L40AqO7U3PNMmI8dVUthCuPUz4toXyuDqjOtuzAMiX8eimghKEnwb0LqcbWMLUxIGvYMD1biUnE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395583012285.1951286915628; Mon, 16 Mar 2020 14:53:03 -0700 (PDT) Received: from localhost ([::1]:49574 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxfS-0005VD-0i for importer@patchew.org; Mon, 16 Mar 2020 17:53:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43122) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIA-0004JR-2Q for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI8-00073l-Ps for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:57 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:36098) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI7-00070H-55 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:55 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-185-lpMduZLMPfyCpCJWWPVudw-1; Mon, 16 Mar 2020 17:28:52 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AC85C180454B for ; Mon, 16 Mar 2020 21:28:51 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B8E5719C4F; Mon, 16 Mar 2020 21:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+B+CdBtdT91xG48LJ61qZJLTftidDcyWk+tCWm4HNZ4=; b=O+x181prFpGGs8NVYKW3uP0+LvR7T2oTySUlAvDCOYrJJoZWyYC3DcQWT082L/Oep3LA2e oXFeFeRo2ghs7bm9Xem/G+t5f0j+9cYhRVNdF34YquY8QFh+FQZMwAWRhzz/ibwapzXRY3 us/QSqjYjgSx+cl9QeP4JNdwCMe6H64= X-MC-Unique: lpMduZLMPfyCpCJWWPVudw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 43/61] hw/m68k: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:10 +0100 Message-Id: <1584394048-44994-44-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index c5699f6..81749e7 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -399,13 +399,12 @@ static void q800_init(MachineState *machine) uint8_t *ptr; /* allocate and load BIOS */ rom =3D g_malloc(sizeof(*rom)); - memory_region_init_ram(rom, NULL, "m68k_mac.rom", MACROM_SIZE, + memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE, &error_abort); if (bios_name =3D=3D NULL) { bios_name =3D MACROM_FILENAME; } filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_set_readonly(rom, true); memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom); =20 /* Load MacROM binary */ --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395699; cv=none; d=zohomail.com; s=zohoarc; b=QrzkbQhW7l9Kt50VJJzz4fs7XfoH19UhM/gPW7o6E0uUoXFr1H+dGZ+Kz+sd2X3zKVAi6do0TmmQ/hX1UStzQcOXRHI59O5+LqzXAhMSZbeuTr5lAWY36nki8oRNFUzTtj9A+y5PajLtgtSvcDYu2DWbyLnHjsAFZrjK2W/wvNg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395699; 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=xTf/P4Ei2kgvn4nYu5zgsi1sCPptHxi3UUHa2HfOsOI=; b=gwBwXawFb+8kwryjNcr0vK5DqU1Mp/SHqNVgUewthqmoiStGlGGiHwyZWC0Nc5cvAtDsjjuceNerexnG4EN5WgntSdZAXHZ8nwhuXPE69TFbOz1o2ervSNzfQaF5VnrlgG3MTcqqy5VXNXPRYDmifMbgScMFcwfIXiKha69Zqw8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395699461404.9201966010821; Mon, 16 Mar 2020 14:54:59 -0700 (PDT) Received: from localhost ([::1]:49600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxhK-0000Qv-Ax for importer@patchew.org; Mon, 16 Mar 2020 17:54:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43121) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIA-0004JP-31 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI8-000757-U0 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:57 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:44600) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI8-000735-OH for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:56 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-483-MB3b7KkJMDCUbUltBVc0Gg-1; Mon, 16 Mar 2020 17:28:54 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 16507100550E for ; Mon, 16 Mar 2020 21:28:53 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 221DE19C4F; Mon, 16 Mar 2020 21:28:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394135; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xTf/P4Ei2kgvn4nYu5zgsi1sCPptHxi3UUHa2HfOsOI=; b=JmBJl4DkOIgjj3CQ9DCJEl0wu8PD6IU5keIMuUNJN0Q8hnLtsAU1LNZPKE6ug2Z9Zw6F3+ P2XFV01abWjswu469sG9DVTeFUL3U1o6pW12SW2kwc9J8pmRzYhaWuCW12JWnru9TTjPR2 5zxJss3K38JUGTMMesVwWspt3A93ilU= X-MC-Unique: MB3b7KkJMDCUbUltBVc0Gg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 44/61] hw/net: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:11 +0100 Message-Id: <1584394048-44994-45-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/dp8393x.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 81fc13e..1563c11 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -986,13 +986,12 @@ static void dp8393x_realize(DeviceState *dev, Error *= *errp) =20 s->watchdog =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s); =20 - memory_region_init_ram(&s->prom, OBJECT(dev), - "dp8393x-prom", SONIC_PROM_SIZE, &local_err); + memory_region_init_rom(&s->prom, OBJECT(dev), "dp8393x-prom", + SONIC_PROM_SIZE, &local_err); if (local_err) { error_propagate(errp, local_err); return; } - memory_region_set_readonly(&s->prom, true); prom =3D memory_region_get_ram_ptr(&s->prom); checksum =3D 0; for (i =3D 0; i < 6; i++) { --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395346; cv=none; d=zohomail.com; s=zohoarc; b=efyWsRquoagxPiIKArI9k4yAsM2/Vw/TfDiLDyxqLHdgAZ3muiWBS0c2wYTPTlR7pDMrO7+8cL7MpJ4ScEWhZGqorqL/KkDwtxNysY8rzU5MAvr8kTHDWVUFGhGkONmWBFPv0ug+Aqe323b9nU9CJmd98dOO/yUFDYeO0CTQXa8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395346; 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=EbuOfoB8s9Uca3voJAdFqyZsNughv+wIrC2AkjrMup4=; b=bNVwBVk+amqnUD/cyvH4U5yA7j59CNfZVJcRrQSjHUiYdGzJFGw9d+NJQTOlxVAzhS7gNpSRpjL8EGZn3MVQn2hnaEd7si6y5vHBmAgZL4KjInta8ksMZsHwkD0ibw/ftnkuQYw4jdRvAB+V4jawFcpVjI2qmyUdriUM7WLr7yM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395346882244.57878248400925; Mon, 16 Mar 2020 14:49:06 -0700 (PDT) Received: from localhost ([::1]:49516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxbd-0007yc-NC for importer@patchew.org; Mon, 16 Mar 2020 17:49:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43154) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIA-0004LL-VJ for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxI9-0007Cu-QK for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:58 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:53271) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxI9-00078F-JT for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:57 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-276-KZJGYFFVOOSzEmkOMqQ0pA-1; Mon, 16 Mar 2020 17:28:55 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 736C8801E53 for ; Mon, 16 Mar 2020 21:28:54 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7FBE819C4F; Mon, 16 Mar 2020 21:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394137; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EbuOfoB8s9Uca3voJAdFqyZsNughv+wIrC2AkjrMup4=; b=Wjtuvqad8vekbT1ysqsUZWGAF5neWMprPoTw2DfMVPQIJhm2FEXsoyH84fAAvq/GWtCURH wRT2SjOT4KQnSG9uojQxzdJAks5DgeV5J9S75oqakNO82zASgt0LBAsRlyUFWaOCdYL4AW dFMS/vYNVxAqdHoQ7UbXkwmfvdaJv/g= X-MC-Unique: KZJGYFFVOOSzEmkOMqQ0pA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 45/61] hw/pci-host: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:12 +0100 Message-Id: <1584394048-44994-46-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Acked-by: David Gibson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci-host/prep.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/pci-host/prep.c b/hw/pci-host/prep.c index 1aff72b..1a02e9a 100644 --- a/hw/pci-host/prep.c +++ b/hw/pci-host/prep.c @@ -325,9 +325,8 @@ static void raven_realize(PCIDevice *d, Error **errp) d->config[0x0D] =3D 0x10; // latency_timer d->config[0x34] =3D 0x00; // capabilities_pointer =20 - memory_region_init_ram_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZ= E, - &error_fatal); - memory_region_set_readonly(&s->bios, true); + memory_region_init_rom_nomigrate(&s->bios, OBJECT(s), "bios", BIOS_SIZ= E, + &error_fatal); memory_region_add_subregion(get_system_memory(), (uint32_t)(-BIOS_SIZE= ), &s->bios); if (s->bios_name) { --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396205; cv=none; d=zohomail.com; s=zohoarc; b=a8JKcJ1n/I3DpcrEz5SlayVj8wZhuWKjPP1dwB+xwKIjDkY1XUIBF3jpG3RR4jSkA+9e8qc2MMyZtI4k37hedT2FHNT+CCry/J3H5XJl3jLRcoQ2kGI5u1Bw42zIbfQLCIwGwMLeNxOQZzslcHOXNNRUGr9ibIXqkS8RM9khZLg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396205; 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=EvL+epyjx14mS3CSa5iUUMcni6haMQqXfvwAPwfhro8=; b=Febc8XCQ04a0O4Rh8KTHeQp+oNQXCek/L3NJ8P/Faj/ckYy2BdIN9/flbDEkZjWzn3aBPy6AHNsFAJQ81adoibHdFlNQEvzJad2KDMk5IeHldWJ6MiAlxQkUOgUpqWHkuWneSjiBQxaG6cqNS48X7V4cuxZE3H9PR8MeXYG8JQw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396205754415.2953370236146; Mon, 16 Mar 2020 15:03:25 -0700 (PDT) Received: from localhost ([::1]:49738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxpT-0006Hd-L2 for importer@patchew.org; Mon, 16 Mar 2020 18:03:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43209) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIE-0004P7-7z for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIA-0007KK-PS for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:00 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:58068) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIA-0007Fk-Hs for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:28:58 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-224-jJIN9LaINwmrugErZar4ng-1; Mon, 16 Mar 2020 17:28:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0BC3800D53 for ; Mon, 16 Mar 2020 21:28:55 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id DE1BF19C4F; Mon, 16 Mar 2020 21:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394138; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EvL+epyjx14mS3CSa5iUUMcni6haMQqXfvwAPwfhro8=; b=ckQzuIAVtNeFfzjzWM69b9iCWneVDqm1ZKo+45GMuO+ciLSaAnuOSO/0adM1Qu4l7xpjsz C5TWfbqlWkkYUhBBTybqrw2fH+TmObm2dvm9M10KO1Tks0zhV3ma/o09ZgorntmutK9fjZ VVZyUp9gl/wAu3NCq5ApY7j/0hctMic= X-MC-Unique: jJIN9LaINwmrugErZar4ng-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 46/61] hw/ppc: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:13 +0100 Message-Id: <1584394048-44994-47-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Acked-by: David Gibson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ppc/mac_newworld.c | 3 +-- hw/ppc/mac_oldworld.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index b8189bf..b2ec372 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -155,13 +155,12 @@ static void ppc_core99_init(MachineState *machine) memory_region_add_subregion(get_system_memory(), 0, machine->ram); =20 /* allocate and load BIOS */ - memory_region_init_ram(bios, NULL, "ppc_core99.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "ppc_core99.bios", BIOS_SIZE, &error_fatal); =20 if (bios_name =3D=3D NULL) bios_name =3D PROM_FILENAME; filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_set_readonly(bios, true); memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios); =20 /* Load OpenBIOS (ELF) */ diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 440c406..faaa165 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -129,13 +129,12 @@ static void ppc_heathrow_init(MachineState *machine) memory_region_add_subregion(sysmem, 0, machine->ram); =20 /* allocate and load BIOS */ - memory_region_init_ram(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE, &error_fatal); =20 if (bios_name =3D=3D NULL) bios_name =3D PROM_FILENAME; filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_set_readonly(bios, true); memory_region_add_subregion(sysmem, PROM_ADDR, bios); =20 /* Load OpenBIOS (ELF) */ --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396310; cv=none; d=zohomail.com; s=zohoarc; b=Gb/xYRf0O97S0QzS9K+0MY0QgkYIiWHiIb//iV26IXUSvrJy07bwclppw7xlxW3t0bM1xZ0bAL+xuefEfZqwLJ0I38OMZwSs2oZomH0I375U9fozxi1MteOV/d/H1R1JJmSQ5gXfZ1h8nPXsplNNQjqtCAmEmeceo6afqSL35Gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396310; 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=0ZS5rxCyLh178NtxVdzWqFLY1vdgdp8r2Q2Vnz+rOz4=; b=Q1MTHwMKJUjCkOkz5Q8l57nPtOwldCgKhmK98TIHbnWQb9jrqzOJSO+co/egMMT7E2NS8KmH7ieMUrmNzE4hU2J0mFI2eZWFWD2XC8zTEjZYqZJcDpPTfVvfus1VpBgZrgTSdAbKC4C0lY0EYM4U/Ogbl78YhwJN86HsjAsf5P8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396310741295.038632622425; Mon, 16 Mar 2020 15:05:10 -0700 (PDT) Received: from localhost ([::1]:49750 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxrB-0008BF-7b for importer@patchew.org; Mon, 16 Mar 2020 18:05:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43261) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIF-0004Ry-JJ for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIE-0007VQ-D5 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:03 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:51965) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIE-0007RV-6T for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-244-SrZ2oj8bPK60Ji_FM7B7-w-1; Mon, 16 Mar 2020 17:28:58 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A211107ACC7 for ; Mon, 16 Mar 2020 21:28:57 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46B3119C4F; Mon, 16 Mar 2020 21:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ZS5rxCyLh178NtxVdzWqFLY1vdgdp8r2Q2Vnz+rOz4=; b=L0hDCGF7YmqA6RAywOP56Jzv9UY7PyTPl2hjZ8CvaatT2vxur4JVe6pGk+0gejDqneTBSZ D5GjNOVairHQbVd/dbCFaZMoX5nlNHuWBaUspGyhtS74CO1fX/s0V3cBr4ziy+qCqjzz2h IRzJgDiDV2H2FqKVZmqeItzHK8zBPcA= X-MC-Unique: SrZ2oj8bPK60Ji_FM7B7-w-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 47/61] hw/riscv: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:14 +0100 Message-Id: <1584394048-44994-48-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/riscv/sifive_e.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index a254cad..a1974ef 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -208,9 +208,8 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev= , Error **errp) memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size); =20 /* Flash memory */ - memory_region_init_ram(&s->xip_mem, NULL, "riscv.sifive.e.xip", - memmap[SIFIVE_E_XIP].size, &error_fatal); - memory_region_set_readonly(&s->xip_mem, true); + memory_region_init_rom(&s->xip_mem, NULL, "riscv.sifive.e.xip", + memmap[SIFIVE_E_XIP].size, &error_fatal); memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base, &s->xip_mem); } --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395819; cv=none; d=zohomail.com; s=zohoarc; b=Bt/8Y8ukHNLXE+8VxUfIFUN4+7RySgBMsWsn5ls5PSxc+EQud1a+KwukM1PGEWUqlzGUXbiOuHugMlss2IUP2YnfRt38ZN8onXvK5KNXEid0Ps4Ja6l3ZtpVmisj7/+fol/KtT4b5hZBXwiOel+bi9P45ipO67AZdUJV3ZeMBtc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395819; 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=+VVBmEG+Gz83kB+1uazf1OEJTFnlW9jhaUAS3GJCtxo=; b=AcVcESH2/lzE4Hi5PL0Yg4c3GD4GdX5jPKwKm8NTVD+EuvZe7joU6RA6Si++NDtiq9Yg9nhxxvpfbtLR+BFLpTOdpGhlhZNr3siTyvlGDooAMThQmzFXJogMqI/3YuqtWibTdNz4NHiXWsYDPwLE68H2FdNrtr+XJw/dIc9dmU0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395819749118.30056949483696; Mon, 16 Mar 2020 14:56:59 -0700 (PDT) Received: from localhost ([::1]:49636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxjG-0004Dd-Nj for importer@patchew.org; Mon, 16 Mar 2020 17:56:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43273) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIF-0004SZ-VD for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIE-0007Yh-RK for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:03 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:47989) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIE-0007TG-Lz for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:02 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-147-VJtbrVYmMyOUfDoGR0PLDQ-1; Mon, 16 Mar 2020 17:28:59 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 972B21005510 for ; Mon, 16 Mar 2020 21:28:58 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id A43A619C4F; Mon, 16 Mar 2020 21:28:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394141; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+VVBmEG+Gz83kB+1uazf1OEJTFnlW9jhaUAS3GJCtxo=; b=ZekR5Fk1hx79GoXjoWXK1wq/9P495SR+OzxKcsDmwbhvmPz3ualA2421on/v9JqsRQknja zIetxBvuY0o8HqZAO2tKA44avtmHU4+yDl/CCXM4IfhQwEjtRKXu7mgIlg7f650LkjXqkt WwI6h4uA6wyY7j/wYCa6DkNH56LYjRU= X-MC-Unique: VJtbrVYmMyOUfDoGR0PLDQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 48/61] hw/sh4: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:15 +0100 Message-Id: <1584394048-44994-49-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sh4/shix.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/sh4/shix.c b/hw/sh4/shix.c index 68b14ee..f410c08 100644 --- a/hw/sh4/shix.c +++ b/hw/sh4/shix.c @@ -53,8 +53,7 @@ static void shix_init(MachineState *machine) cpu =3D SUPERH_CPU(cpu_create(machine->cpu_type)); =20 /* Allocate memory space */ - memory_region_init_ram(rom, NULL, "shix.rom", 0x4000, &error_fatal); - memory_region_set_readonly(rom, true); + memory_region_init_rom(rom, NULL, "shix.rom", 0x4000, &error_fatal); memory_region_add_subregion(sysmem, 0x00000000, rom); memory_region_init_ram(&sdram[0], NULL, "shix.sdram1", 0x01000000, &error_fatal); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395496; cv=none; d=zohomail.com; s=zohoarc; b=kIhu9rq0sRhjwfyf71nWsqwEySnO4Ucm6dxVVvNES2i1VA84AWbUaYgBPYSrwiFFBD4+VOeb1/pUut1o+eU3urqXkVOaVEWWZ11CHpKtLoUNuy0FM5IJ6BPAC1EiwhFQK25gcr7S9ahHOUePg8+og225odyGA8j1y+hF/gNKMFM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395496; 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=Jw4q8DfrZQEahnQ+KEAR6m3aXaWL2VdhlvmmQmQERbA=; b=ESMMCiH5yeHpwW51bVdwoCz72+KEoUWLuAFhCVXDya/GHZ1m8xF+hByzzDkTZKvGMJ+i9bYhJrhTYfjHSB/AqXcMdDfa3gsP++EcBFic2uP/J5jkKUd0jZGE2Z55oXEO4eJBcIj+o2coxqo4D1sUL3BHrqNSa0mp9fGK4F7ot90= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395496334666.8644908128921; Mon, 16 Mar 2020 14:51:36 -0700 (PDT) Received: from localhost ([::1]:49558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxe3-0003Oe-9y for importer@patchew.org; Mon, 16 Mar 2020 17:51:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43286) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIG-0004TX-AO for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIF-0007au-46 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:04 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:36037) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIE-0007Y1-UW for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:03 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-167-ALAXCyJrMnmDQPpX2jm7FQ-1; Mon, 16 Mar 2020 17:29:00 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F3D02149C0 for ; Mon, 16 Mar 2020 21:28:59 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0C4C519C4F; Mon, 16 Mar 2020 21:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Jw4q8DfrZQEahnQ+KEAR6m3aXaWL2VdhlvmmQmQERbA=; b=WIQF+hJEv1I9+mS6M6ZJxxy3z7ChAQ5QfKvsU6DrRwnQHlKmsfoQ3MbHhGPvwS7JCf8xVY a8w7oaN8mgx3H7Wp9TrTszWLYlTVawTYFecjH8lHWkpa3WB78By2y0kB1Tgg8si/vV8DXO FEQ8U4z0Dij745Ef34KOhFUmMaQJ5Sc= X-MC-Unique: ALAXCyJrMnmDQPpX2jm7FQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 49/61] hw/sparc: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:16 +0100 Message-Id: <1584394048-44994-50-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Reviewed-by: KONRAD Frederic Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/sparc/leon3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/sparc/leon3.c b/hw/sparc/leon3.c index 5fa58aa..8f024da 100644 --- a/hw/sparc/leon3.c +++ b/hw/sparc/leon3.c @@ -255,8 +255,7 @@ static void leon3_generic_hw_init(MachineState *machine) =20 /* Allocate BIOS */ prom_size =3D 8 * MiB; - memory_region_init_ram(prom, NULL, "Leon3.bios", prom_size, &error_fat= al); - memory_region_set_readonly(prom, true); + memory_region_init_rom(prom, NULL, "Leon3.bios", prom_size, &error_fat= al); memory_region_add_subregion(address_space_mem, LEON3_PROM_OFFSET, prom= ); =20 /* Load boot prom */ --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395919; cv=none; d=zohomail.com; s=zohoarc; b=YX7wT9NdiUmrBFwfH2ios7+RkHNAF0EibrlaUgvVEBV4QxS+Ks3CEsayWlOXbNQxcLoHwTISyDZLn9JXCMVafm1TKCx0YP872x767nNiGsMIgohFpmHbZBGsP/Q05k3+AfYT3gGjTHpvSTu064hmbeDujMC0ruH2t7MHYoVnDQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395919; 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=V2wF3F3WBpzvnwxC3O9zi1T8Ykf2Sx26HpXYGZHJQto=; b=dHwGmuPoIK1DNjMgNoQ9ia682GNxYUbS/gR4xYcEX4VLJtyDxvemU0XfSroJyXuJw6bfsf0I+o9IRfox8xwvspAFUaV8dV/S/CdCDX/c5vDbx6Z1AMW1HVkY6S06X0zqPZawsibGmDQ/wfJtrN/dHOsU+p3ksecWS09yFLT0kzM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395919409532.191079274751; Mon, 16 Mar 2020 14:58:39 -0700 (PDT) Received: from localhost ([::1]:49662 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxks-0007XH-Bw for importer@patchew.org; Mon, 16 Mar 2020 17:58:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43359) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxII-0004Y5-SK for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIG-0007l2-PT for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:06 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:45894) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIG-0007i4-Ia for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:04 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-68-4nBALNHUO7iQeEwZaf7FcA-1; Mon, 16 Mar 2020 17:29:02 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60269149C4 for ; Mon, 16 Mar 2020 21:29:01 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 683AA19C4F; Mon, 16 Mar 2020 21:29:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V2wF3F3WBpzvnwxC3O9zi1T8Ykf2Sx26HpXYGZHJQto=; b=O+8sYLjc+R9DAgvqimwh0aCBCIFXPlf+EDhlm+zA6FVDRx7sEaeufv4QJ59niAMjUOETdE pRkoQzIcvlJL3kO95QHhEW8cO+InA6+73E7UsEXvT/HFMxsrNahf96MQZgNLZDkstUa02i dkE5n9cg/fQKEDLt4ya7062nzmFQ6cc= X-MC-Unique: 4nBALNHUO7iQeEwZaf7FcA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 50/61] scripts/cocci: Patch to detect potential use of memory_region_init_rom Date: Mon, 16 Mar 2020 22:27:17 +0100 Message-Id: <1584394048-44994-51-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Add a semantic patch to detect potential replacement of memory_region_init_ram(readonly) by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- scripts/coccinelle/memory-region-housekeeping.cocci | 19 +++++++++++++++++= ++ 1 file changed, 19 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index ee3923d..9cdde71 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -29,6 +29,25 @@ symbol true; ) =20 =20 +@possible_memory_region_init_rom@ +expression E1, E2, E3, E4, E5; +position p; +@@ +( + memory_region_init_ram@p(E1, E2, E3, E4, E5); + ... + memory_region_set_readonly(E1, true); +| + memory_region_init_ram_nomigrate@p(E1, E2, E3, E4, E5); + ... + memory_region_set_readonly(E1, true); +) +@script:python@ +p << possible_memory_region_init_rom.p; +@@ +cocci.print_main("potential use of memory_region_init_rom*() in ", p) + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396067; cv=none; d=zohomail.com; s=zohoarc; b=cF9l8zeUYapWytt8Ehkuq9n8A6tnz3SQ3fCqwtqgUX2KTunUbHZPj6vps2Qy0JJVxM7MwsYnokG0tblH+AJ9/2V+K+wfpnY86uWfR2DZCIKN4RdTqqGabMOkuealWyh4OUtEoXbQmXf9pTFxNE62RgxRphEluahijE2znRNAMDc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396067; 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=9r5ZCGJbAAnGpKj9o114KTcLohOklv7xK1En4W7wjp0=; b=CgYorS75iQVI+ITHQcpUY24hxxSj6O6RDPy4Sb6VsopS5jScM2EAIrf0xF+L/rZM6xHxHxapcRfHTpr/JHRdG0VxyTW3o6YS4Ej+n/WZLFD1SYi5LS4CuayKYIUDcvddIaEbRyS9uUpsxNAeVryAaXpamGXTWpzBS51fEo7FZ9Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396067642631.418107383335; Mon, 16 Mar 2020 15:01:07 -0700 (PDT) Received: from localhost ([::1]:49702 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxnF-00033Q-4A for importer@patchew.org; Mon, 16 Mar 2020 18:01:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43376) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIJ-0004Zo-HY for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxII-0007sM-DM for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:07 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:22761) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxII-0007pT-7F for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:06 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-268-pR6YfVZFN-O7crJi5HxxXA-1; Mon, 16 Mar 2020 17:29:03 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BC946800D5E for ; Mon, 16 Mar 2020 21:29:02 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id C816D19C4F; Mon, 16 Mar 2020 21:29:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394145; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9r5ZCGJbAAnGpKj9o114KTcLohOklv7xK1En4W7wjp0=; b=WL66LtQM/P21nPMsnLxNhvKlPEM1bA3KqPD6W+xa0Hp1B8ap3z8WUBxBfey5hagf04VUFQ gPW0EuSbRmRa+9UDvdasOX5ED/opys1BuQPYbROa4/eC3igJORx8nMrGtatbSjj4FD098N 4KUJV85xTOGamQXIqJFRbHZtvwsOX8A= X-MC-Unique: pR6YfVZFN-O7crJi5HxxXA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 51/61] scripts/cocci: Patch to remove unnecessary memory_region_set_readonly() Date: Mon, 16 Mar 2020 22:27:18 +0100 Message-Id: <1584394048-44994-52-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Add a semantic patch to remove memory_region_set_readonly() calls on ROM memory regions. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- scripts/coccinelle/memory-region-housekeeping.cocci | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 9cdde71..5e6b31d 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -48,6 +48,21 @@ p << possible_memory_region_init_rom.p; cocci.print_main("potential use of memory_region_init_rom*() in ", p) =20 =20 +// Do not call memory_region_set_readonly() on ROM alias +@@ +expression ROM, E1, E2, E3, E4; +expression ALIAS, E5, E6, E7, E8; +@@ +( + memory_region_init_rom(ROM, E1, E2, E3, E4); +| + memory_region_init_rom_nomigrate(ROM, E1, E2, E3, E4); +) + ... + memory_region_init_alias(ALIAS, E5, E6, ROM, E7, E8); +- memory_region_set_readonly(ALIAS, true); + + // Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram // code sequences with use of the new memory_region_init_ram function. // Similarly for the _rom and _rom_device functions. --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395898; cv=none; d=zohomail.com; s=zohoarc; b=fnAOdZQAF2wjJYc4G3KJ7+rqJ01SxhGZPH3m6B0ewQExHMdBCX3ewRjDUJBs7HokFHI0uCWcSymdJ2emh4yV2mpeoDRbBoQvOpbK5hqo+durfnz12M/urw3QXbS+9Gf78qNXL8AQZs8V+mqJWY4dknTcnAXv2J2RC762Us9eVzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395898; 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=Zzu/3WU0sPNH9lefVz4BswbZFwOVpA8KpkL8eSt/B6Q=; b=R6RckCJq9oAICK1cXlUdxx3HSQ5jK2DthMstCUVdGus+hw6m0y6ifC406Sax/x32+UgLKiaCLwO6DMDSe4HwuWqC3IrP9erDogIEwT1QVUrho0b6pdC1s8J2ANvq6CGhn0sSzd9MQSOSoIfy9f2ruxbxlChj9aXdVNja91+cAqA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395898954653.4731338243702; Mon, 16 Mar 2020 14:58:18 -0700 (PDT) Received: from localhost ([::1]:49650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxkX-0006o5-P3 for importer@patchew.org; Mon, 16 Mar 2020 17:58:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43417) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIK-0004cA-Em for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIJ-0007x9-3s for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:08 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:27222) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxII-0007tX-RG for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:06 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-150-RJygm3ZMNo-v_wHqleMVdw-1; Mon, 16 Mar 2020 17:29:04 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 26916801A02 for ; Mon, 16 Mar 2020 21:29:04 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 314F319756; Mon, 16 Mar 2020 21:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Zzu/3WU0sPNH9lefVz4BswbZFwOVpA8KpkL8eSt/B6Q=; b=iyDM+qnBOT73VedkYticsJv0blJWCeEBPpDQkqIYH9PUQ4r5iXWk1u647pxb1QokCBcvJe 2bWngYBmoUQSHKaS3Qyc1rleLVA9QwQ3AY3Ls4v2Oi0s38jrJbL5GrU3PqleDyWZvExhqD e5ZxM/U/Ymhbkg2JFRQ9+b5mV+dDt9Y= X-MC-Unique: RJygm3ZMNo-v_wHqleMVdw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 52/61] scripts/cocci: Patch to let devices own their MemoryRegions Date: Mon, 16 Mar 2020 22:27:19 +0100 Message-Id: <1584394048-44994-53-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 When a device creates a MemoryRegion without setting its ownership, the MemoryRegion is added to the machine "/unattached" container in the QOM tree. Example with the Samsung SMDKC210 board: $ arm-softmmu/qemu-system-arm -M smdkc210 -S -monitor stdio (qemu) info qom-tree /machine (smdkc210-machine) /unattached (container) /io[0] (qemu:memory-region) /exynos4210.dram0[0] (qemu:memory-region) /exynos4210.irom[0] (qemu:memory-region) /exynos4210.iram[0] (qemu:memory-region) /exynos4210.chipid[0] (qemu:memory-region) ... /device[26] (exynos4210.uart) /exynos4210.uart[0] (qemu:memory-region) /soc (exynos4210) ^ \__ [*] The irom/iram/chipid regions should go under 'soc' at [*]. Add a semantic patch to let the device own the memory region. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- .../coccinelle/memory-region-housekeeping.cocci | 56 ++++++++++++++++++= ++++ 1 file changed, 56 insertions(+) diff --git a/scripts/coccinelle/memory-region-housekeeping.cocci b/scripts/= coccinelle/memory-region-housekeeping.cocci index 5e6b31d..c768d81 100644 --- a/scripts/coccinelle/memory-region-housekeeping.cocci +++ b/scripts/coccinelle/memory-region-housekeeping.cocci @@ -101,3 +101,59 @@ expression ERRP; +memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP); ... -vmstate_register_ram_global(MR); + + +// Device is owner +@@ +typedef DeviceState; +identifier device_fn, dev, obj; +expression E1, E2, E3, E4, E5; +@@ +static void device_fn(DeviceState *dev, ...) +{ + ... + Object *obj =3D OBJECT(dev); + <+... +( +- memory_region_init(E1, NULL, E2, E3); ++ memory_region_init(E1, obj, E2, E3); +| +- memory_region_init_io(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_io(E1, obj, E2, E3, E4, E5); +| +- memory_region_init_alias(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_alias(E1, obj, E2, E3, E4, E5); +| +- memory_region_init_rom(E1, NULL, E2, E3, E4); ++ memory_region_init_rom(E1, obj, E2, E3, E4); +| +- memory_region_init_ram_shared_nomigrate(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_ram_shared_nomigrate(E1, obj, E2, E3, E4, E5); +) + ...+> +} +@@ +identifier device_fn, dev; +expression E1, E2, E3, E4, E5; +@@ +static void device_fn(DeviceState *dev, ...) +{ + <+... +( +- memory_region_init(E1, NULL, E2, E3); ++ memory_region_init(E1, OBJECT(dev), E2, E3); +| +- memory_region_init_io(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_io(E1, OBJECT(dev), E2, E3, E4, E5); +| +- memory_region_init_alias(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_alias(E1, OBJECT(dev), E2, E3, E4, E5); +| +- memory_region_init_rom(E1, NULL, E2, E3, E4); ++ memory_region_init_rom(E1, OBJECT(dev), E2, E3, E4); +| +- memory_region_init_ram_shared_nomigrate(E1, NULL, E2, E3, E4, E5); ++ memory_region_init_ram_shared_nomigrate(E1, OBJECT(dev), E2, E3, E4, E5); +) + ...+> +} --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395632; cv=none; d=zohomail.com; s=zohoarc; b=cb1smPGfaDL9Rvf542pSEQBY4bNn5JajDhIYmW74CLNNQqppJREaQXTXD9kzs+5aEm46Z0Nb4llIzgj+fZDoQHAJ4Pp9oHo3R+4TgE7jgl/Hm9TaeJZsGp2O4s1cGULtzXEJyfbY/8nOLBdOZODIY6rKlLMrXN+RMRtEjgbg8U8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395632; 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=NvojjshWbKNibIvfevzZEffzna8EMSKPqwM6II/kC6w=; b=i9e1IkrxqY2IQlQeAF5m6YB6iZKAfwT6iMd6NUQMgbV8avyfhCUnmEfKGWY+SycLqsQlXgnqcWD9GxlCO6UvA+hdwMH2x0i5V/BwMDNm57AKGy0J9IPFfbgBP/ZsbnFXTqsytU1rs0i/MKZaQKjp2O8kpBwQwnS/niCjkiJyexk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395632002410.71073817147817; Mon, 16 Mar 2020 14:53:52 -0700 (PDT) Received: from localhost ([::1]:49582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxgE-0006rn-VI for importer@patchew.org; Mon, 16 Mar 2020 17:53:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43457) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIL-0004ej-FW for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIK-00088Q-Fe for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:09 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:42412) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIK-00084o-B7 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:08 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-148-YuHdeMGHNsWa77ytqoHWZQ-1; Mon, 16 Mar 2020 17:29:06 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 836C3100550E for ; Mon, 16 Mar 2020 21:29:05 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8DFEB19C4F; Mon, 16 Mar 2020 21:29:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394147; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NvojjshWbKNibIvfevzZEffzna8EMSKPqwM6II/kC6w=; b=cNetMVjaSEviOT+YqgnT5LuVYKLkPo3eiUXls/z6oQgQV4nhQ3I0WyfuwVfkjBUL39gaCN C3EZB/IgX9vHsxfVDMYn73AUMye4WGJ0RjBJiQk5XdzL4vdnJ00VUF2Xld19oeppqdJ0hJ Lh0izES/s7FupMJH3xjgMoqV/6IPyOk= X-MC-Unique: YuHdeMGHNsWa77ytqoHWZQ-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 53/61] hw/core: Let devices own the MemoryRegion they create Date: Mon, 16 Mar 2020 22:27:20 +0100 Message-Id: <1584394048-44994-54-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/core/platform-bus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/core/platform-bus.c b/hw/core/platform-bus.c index 22c5f76..d494e5c 100644 --- a/hw/core/platform-bus.c +++ b/hw/core/platform-bus.c @@ -187,7 +187,8 @@ static void platform_bus_realize(DeviceState *dev, Erro= r **errp) d =3D SYS_BUS_DEVICE(dev); pbus =3D PLATFORM_BUS_DEVICE(dev); =20 - memory_region_init(&pbus->mmio, NULL, "platform bus", pbus->mmio_size); + memory_region_init(&pbus->mmio, OBJECT(dev), "platform bus", + pbus->mmio_size); sysbus_init_mmio(d, &pbus->mmio); =20 pbus->used_irqs =3D bitmap_new(pbus->num_irqs); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396406; cv=none; d=zohomail.com; s=zohoarc; b=jxhwVXis82sfDYuKZjRXWwUv2+UiOSF1mHU3I0FpmPu6651wt/F41WAPPa0N3bL45HGtQRpZxwo/sSxB3cXMGmUlfXB3KjDmunk2tOgpZ34LxQzpwHXTL8MkrJzNYg40wsqduJnpMVG7qVN775YSNQR4UprjBzlOygPifCdunsU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396406; 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=7p3MLZ3d8LKWVb9Q2azzwfZzSAYNFpiViKoFByrCLvc=; b=ZVEVs0SnYwqrSmNP5jFqCARMh3DzIFX/icEzNyqrTyKhmjM6XTpW5Kz6NLnjnqL2lMD6/m0Ygzgvk2PNwuGD2ws3dxrfuJ5lnIJMTn3icTzgwGetR4YLASq0BVpvmgxfoZfxVJG9OWLtxq9VwcjQ/Uxj+NQ0uhXeFkrdcgbN8Wg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396406110823.4955463179701; Mon, 16 Mar 2020 15:06:46 -0700 (PDT) Received: from localhost ([::1]:49784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxsi-0001XD-Si for importer@patchew.org; Mon, 16 Mar 2020 18:06:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43510) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIM-0004ic-S4 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIL-0008Gx-P3 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:10 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:58250) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIL-0008Ep-LB for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:09 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-371-aqK-6ALONKeg_zhDAyjbow-1; Mon, 16 Mar 2020 17:29:07 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE77C801E6D for ; Mon, 16 Mar 2020 21:29:06 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id EABEE19C4F; Mon, 16 Mar 2020 21:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394149; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7p3MLZ3d8LKWVb9Q2azzwfZzSAYNFpiViKoFByrCLvc=; b=SXCTeSmtYQEdiMZICoNd/cheZ7jViCzww1wC1JezcQ5vabcoMHEkTpVpvi8zfHisMZQRO1 012dlS7TEwiKe++YhLqG99RpMarUNEPWmEXBft2L62YHOuGJ4y7RBuVJDOtiwan5IH50bT g7oNqj09kpUHtJWLuLJ+42vin5GH3Sg= X-MC-Unique: aqK-6ALONKeg_zhDAyjbow-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 54/61] hw/display: Let devices own the MemoryRegion they create Date: Mon, 16 Mar 2020 22:27:21 +0100 Message-Id: <1584394048-44994-55-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/display/g364fb.c | 3 ++- hw/display/macfb.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/display/g364fb.c b/hw/display/g364fb.c index 55185c9..adcba96 100644 --- a/hw/display/g364fb.c +++ b/hw/display/g364fb.c @@ -477,7 +477,8 @@ static void g364fb_init(DeviceState *dev, G364State *s) =20 s->con =3D graphic_console_init(dev, 0, &g364fb_ops, s); =20 - memory_region_init_io(&s->mem_ctrl, NULL, &g364fb_ctrl_ops, s, "ctrl",= 0x180000); + memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &g364fb_ctrl_ops, s, + "ctrl", 0x180000); memory_region_init_ram_ptr(&s->mem_vram, NULL, "vram", s->vram_size, s->vram); vmstate_register_ram(&s->mem_vram, dev); diff --git a/hw/display/macfb.c b/hw/display/macfb.c index 8bff16d..b68faff 100644 --- a/hw/display/macfb.c +++ b/hw/display/macfb.c @@ -362,8 +362,8 @@ static void macfb_common_realize(DeviceState *dev, Macf= bState *s, Error **errp) return; } =20 - memory_region_init_io(&s->mem_ctrl, NULL, &macfb_ctrl_ops, s, "macfb-c= trl", - 0x1000); + memory_region_init_io(&s->mem_ctrl, OBJECT(dev), &macfb_ctrl_ops, s, + "macfb-ctrl", 0x1000); =20 memory_region_init_ram_nomigrate(&s->mem_vram, OBJECT(s), "macfb-vram", MACFB_VRAM_SIZE, errp); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396494; cv=none; d=zohomail.com; s=zohoarc; b=AdCAhEf1cy7gekWYoMFvV7p6RNBC3MLT5gEQB4onss5YsfyYUYRa0g8C1L8YwCG4hfearetVHprwXIpkFaIYg3MWNL1I49TSBw1vmdFJDtI6m0oRHXbI53gE/AiIF3p6C9KNuO7PyaOj2NeAnt7/vsSCVbzg7KomeBwuLRJEUjw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396494; 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=dw9IAA80oEFwhIPPLmt5bE5huwn4u6VjW8/3MRSDruw=; b=RpFaHb8RuWwMmN3HGrrfKb5C0jxNBr21G257eL9QKyekFiXKEoswVldtWrlIJXSQzOgkLOHGk5//co/uCMFV7yIFBiQGPhs+Dx8+QgL9swaFGzxlarLrf2wGlQBgtJHq5j1CeVE6MXowgcDvSXLd7Hc2/Q4TK0N7s/+EC3XorxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396494294835.0157289942208; Mon, 16 Mar 2020 15:08:14 -0700 (PDT) Received: from localhost ([::1]:49802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxu9-0004SZ-Ab for importer@patchew.org; Mon, 16 Mar 2020 18:08:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43583) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIO-0004n5-M2 for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIN-0008RF-JS for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:12 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:24963) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIN-0008Oj-DF for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:11 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-42-94--FY7-M8aabNeQWuKbcA-1; Mon, 16 Mar 2020 17:29:09 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 48CE81804547 for ; Mon, 16 Mar 2020 21:29:08 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5417E19C4F; Mon, 16 Mar 2020 21:29:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394151; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dw9IAA80oEFwhIPPLmt5bE5huwn4u6VjW8/3MRSDruw=; b=FH5EsuA/JSOZClzkkGhEPUn8P+q/Oh4FZUzLyU8fwknbb0xUPXVi746tlNQdn2LEKRmsm/ QBEFJdxDoB/kWacrQWLb+mwQvFUfmcmfB5Ey5sFK7WSDJMgDQ6nXVy3s0F38c0NdRG2O6S Ga1IHF/HJSInOV2EwRuRBMVxXe7r9Gk= X-MC-Unique: 94--FY7-M8aabNeQWuKbcA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 55/61] hw/dma: Let devices own the MemoryRegion they create Date: Mon, 16 Mar 2020 22:27:22 +0100 Message-Id: <1584394048-44994-56-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/dma/i8257.c | 2 +- hw/dma/rc4030.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/dma/i8257.c b/hw/dma/i8257.c index bad8deb..ef15c06 100644 --- a/hw/dma/i8257.c +++ b/hw/dma/i8257.c @@ -553,7 +553,7 @@ static void i8257_realize(DeviceState *dev, Error **err= p) I8257State *d =3D I8257(dev); int i; =20 - memory_region_init_io(&d->channel_io, NULL, &channel_io_ops, d, + memory_region_init_io(&d->channel_io, OBJECT(dev), &channel_io_ops, d, "dma-chan", 8 << d->dshift); memory_region_add_subregion(isa_address_space_io(isa), d->base, &d->channel_io); diff --git a/hw/dma/rc4030.c b/hw/dma/rc4030.c index 21e2c36..7434d27 100644 --- a/hw/dma/rc4030.c +++ b/hw/dma/rc4030.c @@ -679,9 +679,9 @@ static void rc4030_realize(DeviceState *dev, Error **er= rp) s->periodic_timer =3D timer_new_ns(QEMU_CLOCK_VIRTUAL, rc4030_periodic_timer, s); =20 - memory_region_init_io(&s->iomem_chipset, NULL, &rc4030_ops, s, + memory_region_init_io(&s->iomem_chipset, o, &rc4030_ops, s, "rc4030.chipset", 0x300); - memory_region_init_io(&s->iomem_jazzio, NULL, &jazzio_ops, s, + memory_region_init_io(&s->iomem_jazzio, o, &jazzio_ops, s, "rc4030.jazzio", 0x00001000); =20 memory_region_init_iommu(&s->dma_mr, sizeof(s->dma_mr), --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395755; cv=none; d=zohomail.com; s=zohoarc; b=mi9Q9xkWEWZfnskGqcb7zJ9kwCqG6cnq4AxTlO4e+DrHHIwijEa/HuxzfK863lVUhqV8cQms/p8mjibj/Ov5ZAgErzR+M1pJ8B+QVD3hPvkdvvrYC54oIQjL7eR3cBT5QTUGXoRXUFy4bntDjZgt7/nXJWCpISYDC3h71cNJYIA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395755; 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=i6PKvm39WMHGkOwAElWbBY5ZrDFHI3cu1c06ixH6pGI=; b=Zfvl6D8Ak/8tTqEDjzihxKiK08Q/OqF7KtQ8+lb+0AwKu9SqnuzJXdRdQHa2heD2fzlXpF87nfwfZyrDVum0ANvRK/GCM0FbR0D4SvqWWMEUjsn2IxdtFVONq4UyLayMupc2kJmqdYpFOwywcO5uUGKEpPH2dlzS8u0MOnILo0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 15843957559231009.9448058215373; Mon, 16 Mar 2020 14:55:55 -0700 (PDT) Received: from localhost ([::1]:49620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxiE-0002K5-RT for importer@patchew.org; Mon, 16 Mar 2020 17:55:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43795) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIU-0004zs-6Z for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIT-0000Wv-1f for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:18 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:43879) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIS-0000VN-Ss for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:16 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-321-cfAM7r9iMHiYnsP8T4tSlw-1; Mon, 16 Mar 2020 17:29:12 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E6A7A800EBC for ; Mon, 16 Mar 2020 21:29:11 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id B2CE319C4F; Mon, 16 Mar 2020 21:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394156; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i6PKvm39WMHGkOwAElWbBY5ZrDFHI3cu1c06ixH6pGI=; b=Gale8slgeI9an2bcgWytu6glLI6vjb36te8ZqhDdlFRhcFoK0xZu88SEBz5yh3YDWYDzG6 r4w08vDri70O3b3xPU0tVJ3Y56532QLD3lQLF3sjpv2m8M4HYxkjarruE3QbB/HS7Rk/1U d5pDYL2OpRkvV758UNHsAoZmwl8spHk= X-MC-Unique: cfAM7r9iMHiYnsP8T4tSlw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 56/61] hw/riscv: Let devices own the MemoryRegion they create Date: Mon, 16 Mar 2020 22:27:23 +0100 Message-Id: <1584394048-44994-57-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/riscv/sifive_e.c | 6 +++--- hw/riscv/sifive_u.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c index a1974ef..646553a 100644 --- a/hw/riscv/sifive_e.c +++ b/hw/riscv/sifive_e.c @@ -145,8 +145,8 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev= , Error **errp) &error_abort); =20 /* Mask ROM */ - memory_region_init_rom(&s->mask_rom, NULL, "riscv.sifive.e.mrom", - memmap[SIFIVE_E_MROM].size, &error_fatal); + memory_region_init_rom(&s->mask_rom, OBJECT(dev), "riscv.sifive.e.mrom= ", + memmap[SIFIVE_E_MROM].size, &error_fatal); memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_MROM].base, &s->mask_rom); =20 @@ -208,7 +208,7 @@ static void riscv_sifive_e_soc_realize(DeviceState *dev= , Error **errp) memmap[SIFIVE_E_PWM2].base, memmap[SIFIVE_E_PWM2].size); =20 /* Flash memory */ - memory_region_init_rom(&s->xip_mem, NULL, "riscv.sifive.e.xip", + memory_region_init_rom(&s->xip_mem, OBJECT(dev), "riscv.sifive.e.xip", memmap[SIFIVE_E_XIP].size, &error_fatal); memory_region_add_subregion(sys_mem, memmap[SIFIVE_E_XIP].base, &s->xip_mem); diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index 156a003..662d42a 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -497,7 +497,7 @@ static void riscv_sifive_u_soc_realize(DeviceState *dev= , Error **errp) &error_abort); =20 /* boot rom */ - memory_region_init_rom(mask_rom, NULL, "riscv.sifive.u.mrom", + memory_region_init_rom(mask_rom, OBJECT(dev), "riscv.sifive.u.mrom", memmap[SIFIVE_U_MROM].size, &error_fatal); memory_region_add_subregion(system_memory, memmap[SIFIVE_U_MROM].base, mask_rom); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396323; cv=none; d=zohomail.com; s=zohoarc; b=l07DdF8eidKF5frxhaBE7FDqa9CyfVcrM23F1sSl/N3rXtPyOGHBy/uphC8YRLES/PoIA1gPjxyEtUeWEY9y0c7d9Mh/bMIF9sy4lnPoDp9foXNaWhGXmsXHjA3TaasuQ5aLMmsiUe25WdcN27Xu/dtEGFpFJVEb4qv5DLvwjS0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396323; 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=UyJYJwyrXVDwqB/1/5y+mISBNG34H5eUjAjosl5aA48=; b=IreyG6De9wLiPsntPKUviPpEb5wioSZWsqu/UZjRXBjRquSRHqE8a+j+Th4yW3Z0vko4aUxKLKgwYrUso2GaHopJasBk4hrswJcJWKnvCkbI76MaXiTffwv5vynd3NzDBuPntBBxfz0+INR+VxbtmGt+c5zrftQPhmd05/XuwI4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396323779686.8437633586767; Mon, 16 Mar 2020 15:05:23 -0700 (PDT) Received: from localhost ([::1]:49752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxrO-0008PS-Og for importer@patchew.org; Mon, 16 Mar 2020 18:05:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43898) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIX-00053s-So for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIV-0000kh-RZ for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:21 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:54380) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIV-0000gr-Lt for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:19 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-SM5NZjoCPGOmpmskCr0jVA-1; Mon, 16 Mar 2020 17:29:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 540021005510 for ; Mon, 16 Mar 2020 21:29:13 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AF0A19C4F; Mon, 16 Mar 2020 21:29:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394159; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UyJYJwyrXVDwqB/1/5y+mISBNG34H5eUjAjosl5aA48=; b=c0dp9ZBztSLCDKN2UY8pqt5oqIKtUanXMYB8HCpemnZlKogHmyIly6PC61pvPZfDTxgc9j 7w2HqzlLWwTKLPQ+W3R8oAGantcLE9K94d2Qaqaj9zaVVZ7/BZrUnGQs7K8y7g+Fm8jRM6 c4Cz83zoEuuhJBgQ3rnJKTIHc15Tlek= X-MC-Unique: SM5NZjoCPGOmpmskCr0jVA-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 57/61] hw/char: Let devices own the MemoryRegion they create Date: Mon, 16 Mar 2020 22:27:24 +0100 Message-Id: <1584394048-44994-58-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/char/serial.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/char/serial.c b/hw/char/serial.c index 9298881..2ab8b69 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -997,7 +997,7 @@ static void serial_io_realize(DeviceState *dev, Error *= *errp) return; } =20 - memory_region_init_io(&s->io, NULL, &serial_io_ops, s, "serial", 8); + memory_region_init_io(&s->io, OBJECT(dev), &serial_io_ops, s, "serial"= , 8); sysbus_init_mmio(SYS_BUS_DEVICE(sio), &s->io); sysbus_init_irq(SYS_BUS_DEVICE(sio), &s->irq); } @@ -1106,8 +1106,9 @@ static void serial_mm_realize(DeviceState *dev, Error= **errp) return; } =20 - memory_region_init_io(&s->io, NULL, &serial_mm_ops[smm->endianness], s= mm, - "serial", 8 << smm->regshift); + memory_region_init_io(&s->io, OBJECT(dev), + &serial_mm_ops[smm->endianness], smm, "serial", + 8 << smm->regshift); sysbus_init_mmio(SYS_BUS_DEVICE(smm), &s->io); sysbus_init_irq(SYS_BUS_DEVICE(smm), &smm->serial.irq); } --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396212; cv=none; d=zohomail.com; s=zohoarc; b=ky/c9rHaCKZkHuREeV74hGJvf5lc+3AcLQu12Gl8swWoAJtyC1IQaa9YUVvoHffRLwSvADpvdOlgACfptDsbHy5tknvLGzXcIhRSXHdYrYC/OkeMGV3HJFFSBZK9dm4gT11qdVgvLWjdBuTddozApuzOTpdb5gh0/BCuKli3/N0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396212; 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=7JHtBbrutJwWHlyGLweh8p4Me2Nx5oDvE7JcGrGjkHM=; b=FsmRbdUkcoBEVUNutiMkf+gIS7DhqYZlYM2E/lC4Zo+IUOG9veaEs59nEz3wsyBmMgqoQb39j5gWPjMtSKuyiHr+fQUFeUhahER1+hEKDGlJ28qps1J8msUeTnpm4y+h2F38W7HNhpQcVEM9U6t2GYMxqvmAIHjy5sPe+jFyH+M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 158439621284885.32094221666603; Mon, 16 Mar 2020 15:03:32 -0700 (PDT) Received: from localhost ([::1]:49740 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxpb-0006ZW-Sa for importer@patchew.org; Mon, 16 Mar 2020 18:03:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43881) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIX-00053K-Ke for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIW-0000lR-GI for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:21 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:26102) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIW-0000lJ-Cy for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-233-jDPzx3T5NVKjzRGYcoGjZw-1; Mon, 16 Mar 2020 17:29:17 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B2700800EBC for ; Mon, 16 Mar 2020 21:29:14 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id BCE7A19C4F; Mon, 16 Mar 2020 21:29:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7JHtBbrutJwWHlyGLweh8p4Me2Nx5oDvE7JcGrGjkHM=; b=BNZ3lt4+qRUwZFWAvKX3nXYqjoKJKrlc37dJMYZKvUaP/qQMP8BC/6n4BhSwkkRXcIEFrO WXk0foxiGEwQRkQzG0ofQvlIPo+2AXsW/k6irjUNTxtYsjBHajdWExnsCsVkGENU8gg2AF 0pETYwCjHvoQYDqJjIg0WZR7OboqlSc= X-MC-Unique: jDPzx3T5NVKjzRGYcoGjZw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 58/61] hw/arm/stm32: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:25 +0100 Message-Id: <1584394048-44994-59-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 The scripts/coccinelle/memory-region-housekeeping.cocci reported: * TODO [[view:./hw/arm/stm32f205_soc.c::face=3Dovl-face1::linb=3D96::colb= =3D4::cole=3D26][potential use of memory_region_init_rom*() in ./hw/arm/st= m32f205_soc.c::96]] * TODO [[view:./hw/arm/stm32f405_soc.c::face=3Dovl-face1::linb=3D98::colb= =3D4::cole=3D26][potential use of memory_region_init_rom*() in ./hw/arm/st= m32f405_soc.c::98]] We can indeed replace the memory_region_init_ram() and memory_region_set_readonly() calls by memory_region_init_rom(). Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/stm32f205_soc.c | 4 +--- hw/arm/stm32f405_soc.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 627fd44..2de5627 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -93,12 +93,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc,= Error **errp) MemoryRegion *flash =3D g_new(MemoryRegion, 1); MemoryRegion *flash_alias =3D g_new(MemoryRegion, 1); =20 - memory_region_init_ram(flash, NULL, "STM32F205.flash", FLASH_SIZE, + memory_region_init_rom(flash, NULL, "STM32F205.flash", FLASH_SIZE, &error_fatal); memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", flash, 0, FLASH_SIZE); - - memory_region_set_readonly(flash, true); memory_region_set_readonly(flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index 9bcad97..b8fca13 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -95,7 +95,7 @@ static void stm32f405_soc_realize(DeviceState *dev_soc, E= rror **errp) Error *err =3D NULL; int i; =20 - memory_region_init_ram(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE, + memory_region_init_rom(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE, &err); if (err !=3D NULL) { error_propagate(errp, err); @@ -103,8 +103,6 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,= Error **errp) } memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias= ", &s->flash, 0, FLASH_SIZE); - - memory_region_set_readonly(&s->flash, true); memory_region_set_readonly(&s->flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->fla= sh); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584395863; cv=none; d=zohomail.com; s=zohoarc; b=NqS6h5dZB8KR/RhlTObvvZBTNYIk8x3vwECwBI1EVWkFTA81O7fUxGD3rnrFuj55FsiYUYbsAV6Q6/xqjaQu9LmYbwiNxetMx35QJBAndFuTAUvR+GxE5aaVayvUMPwWcyDVJz9laGUA6XY5RmMBo6rAot7+Ss8fKc5oFQEXvrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584395863; 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=GZO4UQvxnSQ50fOctevsrcsWiSa/9rRrHMPOif7BTXI=; b=Pgx8v2TVLx6jMzXuJTUY8YMAJdtlKRyO0bQ0NVTou+gxWGUiTnVYn70Xcw1NmyFCnht251CpG+uJNhOJKwkJM6qMbnvq9srVnzSq/B0IMdMDXkmigA6a6dKvQeDmAkiVt/OGzfqLEbzn+uUEvgG4U8ZyhR6lvmSr8pblWRcxBYo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584395863948896.2534600912454; Mon, 16 Mar 2020 14:57:43 -0700 (PDT) Received: from localhost ([::1]:49644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxjy-0005ez-RP for importer@patchew.org; Mon, 16 Mar 2020 17:57:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43921) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIY-000559-FT for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIX-0000qC-6d for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:22 -0400 Received: from us-smtp-delivery-74.mimecast.com ([63.128.21.74]:35659) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIX-0000gD-0s for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:21 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-2-avo8ONVDPe2wNeaGikNv4Q-1; Mon, 16 Mar 2020 17:29:16 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 19925107ACC7 for ; Mon, 16 Mar 2020 21:29:16 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25DE119C4F; Mon, 16 Mar 2020 21:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GZO4UQvxnSQ50fOctevsrcsWiSa/9rRrHMPOif7BTXI=; b=WJABzxt/LH+0xkwcEkbBvvFBSyAkqgaBOF2f0wNHHr9o69kVSCFSNTJlMBZY7RleMazGjH Zui4iK9YjPP82yvEQUm9mOx9KN2Oj4kt+wiZHkf7pQOsnneIOVvuBkn9oZvWj2SaDlhg+J kYrGfPpNDvhKZccvH/JGJlRDtQ37f5A= X-MC-Unique: avo8ONVDPe2wNeaGikNv4Q-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 59/61] hw/ppc/ppc405: Use memory_region_init_rom() with read-only regions Date: Mon, 16 Mar 2020 22:27:26 +0100 Message-Id: <1584394048-44994-60-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 63.128.21.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 The scripts/coccinelle/memory-region-housekeeping.cocci reported: * TODO [[view:./hw/ppc/ppc405_boards.c::face=3Dovl-face1::linb=3D195::colb= =3D8::cole=3D30][potential use of memory_region_init_rom*() in ./hw/ppc/pp= c405_boards.c::195]] * TODO [[view:./hw/ppc/ppc405_boards.c::face=3Dovl-face1::linb=3D464::colb= =3D8::cole=3D30][potential use of memory_region_init_rom*() in ./hw/ppc/pp= c405_boards.c::464]] We can indeed replace the memory_region_init_ram() and memory_region_set_readonly() calls by memory_region_init_rom(). Acked-by: David Gibson Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/ppc/ppc405_boards.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index de93c40..e6bffb9 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -199,7 +199,7 @@ static void ref405ep_init(MachineState *machine) #endif { bios =3D g_new(MemoryRegion, 1); - memory_region_init_ram(bios, NULL, "ef405ep.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "ef405ep.bios", BIOS_SIZE, &error_fatal); =20 if (bios_name =3D=3D NULL) @@ -223,7 +223,6 @@ static void ref405ep_init(MachineState *machine) /* Avoid an uninitialized variable warning */ bios_size =3D -1; } - memory_region_set_readonly(bios, true); } /* Register FPGA */ ref405ep_fpga_init(sysmem, 0xF0300000); @@ -471,7 +470,7 @@ static void taihu_405ep_init(MachineState *machine) if (bios_name =3D=3D NULL) bios_name =3D BIOS_FILENAME; bios =3D g_new(MemoryRegion, 1); - memory_region_init_ram(bios, NULL, "taihu_405ep.bios", BIOS_SIZE, + memory_region_init_rom(bios, NULL, "taihu_405ep.bios", BIOS_SIZE, &error_fatal); filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { @@ -489,7 +488,6 @@ static void taihu_405ep_init(MachineState *machine) error_report("Could not load PowerPC BIOS '%s'", bios_name); exit(1); } - memory_region_set_readonly(bios, true); } /* Register Linux flash */ dinfo =3D drive_get(IF_PFLASH, 0, fl_idx); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396025; cv=none; d=zohomail.com; s=zohoarc; b=RGrgh02dwFb2NxPXU/p+SYY9SkeD6ikApLHjtPWbWYGVnn//vvMcHzVTFzlPIznEsE2prFYp8yFC3OJZuM1gmfsftO8IHT7BABLnLF3TFPs+9pbWJRwi5omejLiMduob/xKc1Z5Kw7hWYj7qQtc/HkYwxxlYW6dwx0ZO/obtjZY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396025; 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=LIcx4caZwvIdgKeGq+fJZK+bLbQUENFvU3cgHfs/DNU=; b=kmxCIkznBj3VX9zKxivLq6AXZvRbCpwTknt/pILHqSnnj+/WfFMuBY4tmLpCGaMPFVJk/EJ2PymVILfT0pA1tV99IG4xthyPn6WySdY5t1zsM+XgrmSYMabab5SeTDdWUIVwGa1V0YsfihrzcJDtqq49qBhwgs3UVWvCTcLEbJ8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396025520933.1392025990027; Mon, 16 Mar 2020 15:00:25 -0700 (PDT) Received: from localhost ([::1]:49680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxma-0002Ed-Bh for importer@patchew.org; Mon, 16 Mar 2020 18:00:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43891) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIX-00053j-QY for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIW-0000lp-LE for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:21 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:56929) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIW-0000lL-HI for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:20 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-151-31HkBqeRNJqnDFd5aX7kUw-1; Mon, 16 Mar 2020 17:29:18 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 782AA107ACCA for ; Mon, 16 Mar 2020 21:29:17 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id 849FC19C4F; Mon, 16 Mar 2020 21:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394160; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LIcx4caZwvIdgKeGq+fJZK+bLbQUENFvU3cgHfs/DNU=; b=e/iIZJIYYZlhGvPbkZvICFeSTKmq441IlcdgJq9qjUi8xwucuK+KJ0REV4x9oQJJPxQYXK BNjTf2SNv9Lgn3oT3pym7+q7EEh1hM9f6yuEAaVyt4BcGcX0lI5pDfi66xAtlCJuqYjBTN Nb3ao6WieF+EL2ivIvLaLJ7W2X68CuI= X-MC-Unique: 31HkBqeRNJqnDFd5aX7kUw-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 60/61] hw/arm: Remove unnecessary memory_region_set_readonly() on ROM alias Date: Mon, 16 Mar 2020 22:27:27 +0100 Message-Id: <1584394048-44994-61-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/exynos4210.c | 1 - hw/arm/stm32f205_soc.c | 1 - hw/arm/stm32f405_soc.c | 1 - 3 files changed, 3 deletions(-) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 3af6502..4e1fd7e 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -320,7 +320,6 @@ static void exynos4210_realize(DeviceState *socdev, Err= or **errp) &s->irom_mem, 0, EXYNOS4210_IROM_SIZE); - memory_region_set_readonly(&s->irom_alias_mem, true); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_MIRROR_BASE_AD= DR, &s->irom_alias_mem); =20 diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 2de5627..6e93726 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -97,7 +97,6 @@ static void stm32f205_soc_realize(DeviceState *dev_soc, E= rror **errp) &error_fatal); memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", flash, 0, FLASH_SIZE); - memory_region_set_readonly(flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); memory_region_add_subregion(system_memory, 0, flash_alias); diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index b8fca13..d590cd0 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -103,7 +103,6 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,= Error **errp) } memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias= ", &s->flash, 0, FLASH_SIZE); - memory_region_set_readonly(&s->flash_alias, true); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->fla= sh); memory_region_add_subregion(system_memory, 0, &s->flash_alias); --=20 1.8.3.1 From nobody Mon Apr 29 06:29:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1584396422; cv=none; d=zohomail.com; s=zohoarc; b=SI4QQznWa+ZZT9xE/LmPt75/UwHWAkQ3V5vXaapRPHy1HwJVUasL9HOcnjCXXRMRR03CFAiRsHXyEUIf2RwufsKODuiLMY/0v8vYCb95dUlwYoZkNp5R3oQjb0Sf32YAu7Uwn1oQO0mX/HZsuVpVk7jjfSHDGSXnDCFIRWf+Lug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584396422; 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=oYHjZDpcNN2ePqEz9llI3P58uy6rKg4XVNTobQcwV+E=; b=k93lODybO2dRBImGQjzv+kOjCeDsszLMC/B1hFA+GNls+/k+WXFEFV9zDEhkyudXvhVhUz7zm2VDK9GQ87SEDhQw9sAu1k+yWEEhIHEaNi9Vs1gBed34PbUtv7LG+bi8PFVe1pSJMW2W8xDgqzgJpNP0C4nehuXE7JFfeNJ764k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (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 1584396422389706.6059490830355; Mon, 16 Mar 2020 15:07:02 -0700 (PDT) Received: from localhost ([::1]:49788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxsz-0001yn-3S for importer@patchew.org; Mon, 16 Mar 2020 18:07:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44019) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jDxIa-0005Aq-TS for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jDxIY-0000zb-IR for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:24 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:45395) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jDxIY-0000wW-CM for qemu-devel@nongnu.org; Mon, 16 Mar 2020 17:29:22 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-343-RZ5djjSPPnO1f51ERfCYyg-1; Mon, 16 Mar 2020 17:29:19 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CEAB78017CC for ; Mon, 16 Mar 2020 21:29:18 +0000 (UTC) Received: from 640k.localdomain.com (unknown [10.36.110.10]) by smtp.corp.redhat.com (Postfix) with ESMTP id E221B19C4F; Mon, 16 Mar 2020 21:29:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1584394162; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oYHjZDpcNN2ePqEz9llI3P58uy6rKg4XVNTobQcwV+E=; b=gbIik6Pp8k11q2NWf+agqOZ51oRvrL0vCbTZRaG+nYPhuRlsixuADyFd7ILs4S0NN0TdcX 50IDshZKV02oGg5UYiNQooBctz1yJHJ8LrhGXutsT6o2OLjP4Yp0cztx7+KONQm1ePSreX 2EDiilNpwUa9HCXbQhuBHIlQwgZRoqM= X-MC-Unique: RZ5djjSPPnO1f51ERfCYyg-1 From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 61/61] hw/arm: Let devices own the MemoryRegion they create Date: Mon, 16 Mar 2020 22:27:28 +0100 Message-Id: <1584394048-44994-62-git-send-email-pbonzini@redhat.com> In-Reply-To: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> References: <1584394048-44994-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 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: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" From: Philippe Mathieu-Daud=C3=A9 Avoid orphan memory regions being added in the /unattached QOM container. This commit was produced with the Coccinelle script scripts/coccinelle/memory-region-housekeeping.cocci. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/exynos4210.c | 12 ++++++------ hw/arm/fsl-imx25.c | 10 +++++----- hw/arm/fsl-imx31.c | 6 +++--- hw/arm/fsl-imx6.c | 6 +++--- hw/arm/fsl-imx6ul.c | 9 +++++---- hw/arm/msf2-soc.c | 6 +++--- hw/arm/nrf51_soc.c | 2 +- hw/arm/stm32f205_soc.c | 8 ++++---- hw/arm/stm32f405_soc.c | 9 +++++---- hw/arm/xlnx-zynqmp.c | 11 +++++------ 10 files changed, 40 insertions(+), 39 deletions(-) diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c index 4e1fd7e..1f7253e 100644 --- a/hw/arm/exynos4210.c +++ b/hw/arm/exynos4210.c @@ -305,20 +305,20 @@ static void exynos4210_realize(DeviceState *socdev, E= rror **errp) /*** Memory ***/ =20 /* Chip-ID and OMR */ - memory_region_init_io(&s->chipid_mem, NULL, &exynos4210_chipid_and_omr= _ops, - NULL, "exynos4210.chipid", sizeof(chipid_and_omr)); + memory_region_init_io(&s->chipid_mem, OBJECT(socdev), + &exynos4210_chipid_and_omr_ops, NULL, + "exynos4210.chipid", sizeof(chipid_and_omr)); memory_region_add_subregion(system_mem, EXYNOS4210_CHIPID_ADDR, &s->chipid_mem); =20 /* Internal ROM */ - memory_region_init_rom(&s->irom_mem, NULL, "exynos4210.irom", + memory_region_init_rom(&s->irom_mem, OBJECT(socdev), "exynos4210.irom", EXYNOS4210_IROM_SIZE, &error_fatal); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_BASE_ADDR, &s->irom_mem); /* mirror of iROM */ - memory_region_init_alias(&s->irom_alias_mem, NULL, "exynos4210.irom_al= ias", - &s->irom_mem, - 0, + memory_region_init_alias(&s->irom_alias_mem, OBJECT(socdev), + "exynos4210.irom_alias", &s->irom_mem, 0, EXYNOS4210_IROM_SIZE); memory_region_add_subregion(system_mem, EXYNOS4210_IROM_MIRROR_BASE_AD= DR, &s->irom_alias_mem); diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index a3f829f..6f1a82c 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -303,16 +303,16 @@ static void fsl_imx25_realize(DeviceState *dev, Error= **errp) } =20 /* initialize 2 x 16 KB ROM */ - memory_region_init_rom(&s->rom[0], NULL, - "imx25.rom0", FSL_IMX25_ROM0_SIZE, &err); + memory_region_init_rom(&s->rom[0], OBJECT(dev), "imx25.rom0", + FSL_IMX25_ROM0_SIZE, &err); if (err) { error_propagate(errp, err); return; } memory_region_add_subregion(get_system_memory(), FSL_IMX25_ROM0_ADDR, &s->rom[0]); - memory_region_init_rom(&s->rom[1], NULL, - "imx25.rom1", FSL_IMX25_ROM1_SIZE, &err); + memory_region_init_rom(&s->rom[1], OBJECT(dev), "imx25.rom1", + FSL_IMX25_ROM1_SIZE, &err); if (err) { error_propagate(errp, err); return; @@ -331,7 +331,7 @@ static void fsl_imx25_realize(DeviceState *dev, Error *= *errp) &s->iram); =20 /* internal RAM (128 KB) is aliased over 128 MB - 128 KB */ - memory_region_init_alias(&s->iram_alias, NULL, "imx25.iram_alias", + memory_region_init_alias(&s->iram_alias, OBJECT(dev), "imx25.iram_alia= s", &s->iram, 0, FSL_IMX25_IRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX25_IRAM_ALIAS_= ADDR, &s->iram_alias); diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c index 55e90d1..8472d2e 100644 --- a/hw/arm/fsl-imx31.c +++ b/hw/arm/fsl-imx31.c @@ -206,7 +206,7 @@ static void fsl_imx31_realize(DeviceState *dev, Error *= *errp) } =20 /* On a real system, the first 16k is a `secure boot rom' */ - memory_region_init_rom(&s->secure_rom, NULL, "imx31.secure_rom", + memory_region_init_rom(&s->secure_rom, OBJECT(dev), "imx31.secure_rom", FSL_IMX31_SECURE_ROM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -216,7 +216,7 @@ static void fsl_imx31_realize(DeviceState *dev, Error *= *errp) &s->secure_rom); =20 /* There is also a 16k ROM */ - memory_region_init_rom(&s->rom, NULL, "imx31.rom", + memory_region_init_rom(&s->rom, OBJECT(dev), "imx31.rom", FSL_IMX31_ROM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -236,7 +236,7 @@ static void fsl_imx31_realize(DeviceState *dev, Error *= *errp) &s->iram); =20 /* internal RAM (16 KB) is aliased over 256 MB - 16 KB */ - memory_region_init_alias(&s->iram_alias, NULL, "imx31.iram_alias", + memory_region_init_alias(&s->iram_alias, OBJECT(dev), "imx31.iram_alia= s", &s->iram, 0, FSL_IMX31_IRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX31_IRAM_ALIAS_= ADDR, &s->iram_alias); diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index ecc6285..9c09f71 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -405,7 +405,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) } =20 /* ROM memory */ - memory_region_init_rom(&s->rom, NULL, "imx6.rom", + memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom", FSL_IMX6_ROM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -415,7 +415,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) &s->rom); =20 /* CAAM memory */ - memory_region_init_rom(&s->caam, NULL, "imx6.caam", + memory_region_init_rom(&s->caam, OBJECT(dev), "imx6.caam", FSL_IMX6_CAAM_MEM_SIZE, &err); if (err) { error_propagate(errp, err); @@ -435,7 +435,7 @@ static void fsl_imx6_realize(DeviceState *dev, Error **= errp) &s->ocram); =20 /* internal OCRAM (256 KB) is aliased over 1 MB */ - memory_region_init_alias(&s->ocram_alias, NULL, "imx6.ocram_alias", + memory_region_init_alias(&s->ocram_alias, OBJECT(dev), "imx6.ocram_ali= as", &s->ocram, 0, FSL_IMX6_OCRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX6_OCRAM_ALIAS_= ADDR, &s->ocram_alias); diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index c405b68..f4a9ed6 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -543,7 +543,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error = **errp) /* * ROM memory */ - memory_region_init_rom(&s->rom, NULL, "imx6ul.rom", + memory_region_init_rom(&s->rom, OBJECT(dev), "imx6ul.rom", FSL_IMX6UL_ROM_SIZE, &error_abort); memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_ROM_ADDR, &s->rom); @@ -551,7 +551,7 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error = **errp) /* * CAAM memory */ - memory_region_init_rom(&s->caam, NULL, "imx6ul.caam", + memory_region_init_rom(&s->caam, OBJECT(dev), "imx6ul.caam", FSL_IMX6UL_CAAM_MEM_SIZE, &error_abort); memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_CAAM_MEM_A= DDR, &s->caam); @@ -568,8 +568,9 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error = **errp) /* * internal OCRAM (128 KB) is aliased over 512 KB */ - memory_region_init_alias(&s->ocram_alias, NULL, "imx6ul.ocram_alias", - &s->ocram, 0, FSL_IMX6UL_OCRAM_ALIAS_SIZE); + memory_region_init_alias(&s->ocram_alias, OBJECT(dev), + "imx6ul.ocram_alias", &s->ocram, 0, + FSL_IMX6UL_OCRAM_ALIAS_SIZE); memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_OCRAM_ALIAS_ADDR, &s->ocram_ali= as); } diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index 8f84692..588d643 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -96,7 +96,7 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Erro= r **errp) MemoryRegion *nvm_alias =3D g_new(MemoryRegion, 1); MemoryRegion *sram =3D g_new(MemoryRegion, 1); =20 - memory_region_init_rom(nvm, NULL, "MSF2.eNVM", s->envm_size, + memory_region_init_rom(nvm, OBJECT(dev_soc), "MSF2.eNVM", s->envm_size, &error_fatal); /* * On power-on, the eNVM region 0x60000000 is automatically @@ -104,8 +104,8 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Er= ror **errp) * start address (0x0). We do not support remapping other eNVM, * eSRAM and DDR regions by guest(via Sysreg) currently. */ - memory_region_init_alias(nvm_alias, NULL, "MSF2.eNVM", - nvm, 0, s->envm_size); + memory_region_init_alias(nvm_alias, OBJECT(dev_soc), "MSF2.eNVM", nvm,= 0, + s->envm_size); =20 memory_region_add_subregion(system_memory, ENVM_BASE_ADDRESS, nvm); memory_region_add_subregion(system_memory, 0, nvm_alias); diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c index 4817a76..57eff63 100644 --- a/hw/arm/nrf51_soc.c +++ b/hw/arm/nrf51_soc.c @@ -165,7 +165,7 @@ static void nrf51_soc_realize(DeviceState *dev_soc, Err= or **errp) } =20 /* STUB Peripherals */ - memory_region_init_io(&s->clock, NULL, &clock_ops, NULL, + memory_region_init_io(&s->clock, OBJECT(dev_soc), &clock_ops, NULL, "nrf51_soc.clock", 0x1000); memory_region_add_subregion_overlap(&s->container, NRF51_IOMEM_BASE, &s->clock, -1); diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index 6e93726..118c342 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -93,10 +93,10 @@ static void stm32f205_soc_realize(DeviceState *dev_soc,= Error **errp) MemoryRegion *flash =3D g_new(MemoryRegion, 1); MemoryRegion *flash_alias =3D g_new(MemoryRegion, 1); =20 - memory_region_init_rom(flash, NULL, "STM32F205.flash", FLASH_SIZE, - &error_fatal); - memory_region_init_alias(flash_alias, NULL, "STM32F205.flash.alias", - flash, 0, FLASH_SIZE); + memory_region_init_rom(flash, OBJECT(dev_soc), "STM32F205.flash", + FLASH_SIZE, &error_fatal); + memory_region_init_alias(flash_alias, OBJECT(dev_soc), + "STM32F205.flash.alias", flash, 0, FLASH_SIZE= ); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, flash); memory_region_add_subregion(system_memory, 0, flash_alias); diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index d590cd0..4f10ce6 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -95,14 +95,15 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,= Error **errp) Error *err =3D NULL; int i; =20 - memory_region_init_rom(&s->flash, NULL, "STM32F405.flash", FLASH_SIZE, - &err); + memory_region_init_rom(&s->flash, OBJECT(dev_soc), "STM32F405.flash", + FLASH_SIZE, &err); if (err !=3D NULL) { error_propagate(errp, err); return; } - memory_region_init_alias(&s->flash_alias, NULL, "STM32F405.flash.alias= ", - &s->flash, 0, FLASH_SIZE); + memory_region_init_alias(&s->flash_alias, OBJECT(dev_soc), + "STM32F405.flash.alias", &s->flash, 0, + FLASH_SIZE); =20 memory_region_add_subregion(system_memory, FLASH_BASE_ADDRESS, &s->fla= sh); memory_region_add_subregion(system_memory, 0, &s->flash_alias); diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c index cab0160..49f1c8d 100644 --- a/hw/arm/xlnx-zynqmp.c +++ b/hw/arm/xlnx-zynqmp.c @@ -318,9 +318,9 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error= **errp) ddr_low_size =3D XLNX_ZYNQMP_MAX_LOW_RAM_SIZE; ddr_high_size =3D ram_size - XLNX_ZYNQMP_MAX_LOW_RAM_SIZE; =20 - memory_region_init_alias(&s->ddr_ram_high, NULL, - "ddr-ram-high", s->ddr_ram, - ddr_low_size, ddr_high_size); + memory_region_init_alias(&s->ddr_ram_high, OBJECT(dev), + "ddr-ram-high", s->ddr_ram, ddr_low_size, + ddr_high_size); memory_region_add_subregion(get_system_memory(), XLNX_ZYNQMP_HIGH_RAM_START, &s->ddr_ram_high); @@ -330,9 +330,8 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error= **errp) ddr_low_size =3D ram_size; } =20 - memory_region_init_alias(&s->ddr_ram_low, NULL, - "ddr-ram-low", s->ddr_ram, - 0, ddr_low_size); + memory_region_init_alias(&s->ddr_ram_low, OBJECT(dev), "ddr-ram-low", + s->ddr_ram, 0, ddr_low_size); memory_region_add_subregion(get_system_memory(), 0, &s->ddr_ram_low); =20 /* Create the four OCM banks */ --=20 1.8.3.1