From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627117049548858.1679195678533; Sat, 24 Jul 2021 01:57:29 -0700 (PDT) Received: from localhost ([::1]:40126 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DTL-0005o1-Rd for importer@patchew.org; Sat, 24 Jul 2021 04:57:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DQw-00031g-SV for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:54:58 -0400 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:42574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DQv-0002sI-Bz for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:54:58 -0400 Received: by mail-ed1-x52a.google.com with SMTP id df26so4661849edb.9 for ; Sat, 24 Jul 2021 01:54:57 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:54:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ADci9kmFOfUAUYnapr+htMkPLZRgVlK8/wLF0z9khFs=; b=k1tnfhi7wP9zk+m0nGPHgJY6+M2RhyKl4onJsFgSkaNhUJEFlS8rPtd/9mErfBrzc2 J/2LLiXXNtpZoOVEyjr0HVGsbBxCONh5Pl4fELFCflD6U/SrkBUupJeZgreUV6LCIamP cJxKU3MBwy3CjacHXm6GpiuRYxQO0ILyxSM50Qvwc+AIuIaLIUrdqNgUR+REhtTpmzED T0ApV2cnrmYUUkIqIYJIz5ow+voYn2sFzn04Y+1PCq0yNIwjmnZKXVXp754uqZFZBYa8 DiFeXCzKIue5/8L5V0RM+JehZ6GmfjjxYa3gSb7vy6NdLoos+A07dmxAK/g/qHhN7CFx ie+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ADci9kmFOfUAUYnapr+htMkPLZRgVlK8/wLF0z9khFs=; b=G3Gd2ws622JrqhEkrqIB4Uy+abflSPwE+LMqiz5c+uA6j8pzoiM76tgI8MZW1kl/fy k/+UK6Gs/lNMH+0zDBitjwnK38E0WNEBBEfIhedAJetJ27p1/CI38SUpkzJv7ydQhBmD dhxOAhX6rmq9fsta+fWlYjS+0PVDVlHLp6CdR93TaDEJUBqzNQyE71dWulrD2voIZcrP azdq3dtgiF1va9r19u+zc6IVHIZYcaa+LzUyK0bwQXIK44KQmBaS61wloaEf38ZJ9jkd JYEQ4a3tIRWs01cZQElAtywDB5wYcc8w21dDEBKiJsVKILTfycS0a/CTbQNXs6gBRG/b XC6A== X-Gm-Message-State: AOAM531X/9ONE5hmmIT6UdijUQ3MRxo3b1sX4Sy1m0S6nXFqXLd4D1x+ u/i/GCPizx/lKo/hsDaf7zDAahLhwUSlwQ== X-Google-Smtp-Source: ABdhPJwTIuemk/6qNM3FF694vJN5rJHY9/1CuJjGkM4em76L9ImrmN7nBoxHAAnaY3n1mB5rnjqr4A== X-Received: by 2002:aa7:cd9a:: with SMTP id x26mr7044629edv.26.1627116896161; Sat, 24 Jul 2021 01:54:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 1/9] meson: fix dependencies for modinfo #2 Date: Sat, 24 Jul 2021 10:54:45 +0200 Message-Id: <20210724085453.16791-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117051753100002 Content-Type: text/plain; charset="utf-8" From: Gerd Hoffmann modinfo runs the preprocessor and therefore needs all generated input files to be there. The "depends" clause does not work in Meson 0.55.3, so for now use "input". Part #2: Update the rule for target-specific modules too. Signed-off-by: Gerd Hoffmann Message-Id: <20210723120156.1183920-1-kraxel@redhat.com> Signed-off-by: Paolo Bonzini --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index df5094e563..f2e148eaf9 100644 --- a/meson.build +++ b/meson.build @@ -2373,9 +2373,9 @@ foreach d, list : target_modules # FIXME: Should use sl.extract_all_objects(recursive: true) to= o. modinfo_files +=3D custom_target(module_name + '.modinfo', output: module_name + '.modinfo= ', - input: target_module_ss.sources= (), + input: target_module_ss.sources= () + genh, capture: true, - command: [modinfo_collect, '--t= arget', target, '@INPUT@']) + command: [modinfo_collect, '--t= arget', target, target_module_ss.sources()]) endif endif endforeach --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627117050195886.4462095101721; Sat, 24 Jul 2021 01:57:30 -0700 (PDT) Received: from localhost ([::1]:40192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DTM-0005r6-Lp for importer@patchew.org; Sat, 24 Jul 2021 04:57:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59928) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DQy-000328-Ac for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:00 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]:42776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DQw-0002tf-67 for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:00 -0400 Received: by mail-ej1-x635.google.com with SMTP id e19so7167406ejs.9 for ; Sat, 24 Jul 2021 01:54:57 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:54:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xdEiRZN1v/sZpkTLvZyGYr+OUpRF15xUtThQLAzFLSs=; b=oEhvt1+E+QBjMj0A4Y68ud3uGNKsbEBw6ZQUPZaVj7GnnsI7ijcEia+P/rWBnGqjO0 37KCUIJk9wvp0/LD4ISF71n/FJHaCkDPKL/x4WGDJwSgd1nmO5jUyVm4sYQjEcBVL6oK Y4GKY+TPqjDItcO8KcJ/9H6OK8DYpSAuKa3y4LWiLoFcfOTJrr692EOTQ35xpIsFx0WQ UKJBIn6aFFbStevEkYdh0ZYXMXfoM3Y1iYXxi64Ox7TfdtTUzTWc3hTuTarR/Vw9GegJ 1oQnQZ4Ejiw8IwMgDEfCQvWpUaA1X+RSVqgoQ1X1IufXSASdA4SpcFhZCsXjWLDy1oWs oWvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xdEiRZN1v/sZpkTLvZyGYr+OUpRF15xUtThQLAzFLSs=; b=nMMe5YfZ/buYe15tI+xfffNZNByJ5hhjf4G0xp9pz7l7Duc8vEVI/23Uch4q0NlTbU f9whNbXj1oM1uExW2gjsaJ47bwF9vZ01jUrbpsEPjs1KoMmWPzZKfE5YnIPTX18e6ryz amy77bbapIISf7p0qeAjk4n8JZrN8TpQOXCqsPCARpqJCGdXJqKGcAujj1zyiohertCR GB7Fx5o2z/9IaZAOKoN74Wuoo6o51mOPgSNubsLvkIBtzt5wNjyTDYbz4oApPxcam3r7 ocUyaCSAGoO4C1duszV9lULCtOhE/noGNu1AsdtgHn276AFsMmkOEOENa8SuSlZpK0pm 6AEw== X-Gm-Message-State: AOAM532JxSSOKDGMIWNizOw58IfaLn67RFUmP+f3zJxfLeccodwgdHIi HGqPr+pjXXY0z1/PEATrPOs7R0skqbebQA== X-Google-Smtp-Source: ABdhPJxUSWannDA2dKNwx6T0Upw2as/lW8Xz1DoqqNCU5XPqfoV9bOpv7VcjnfHY7ncZjs/s1yAznQ== X-Received: by 2002:a17:906:2844:: with SMTP id s4mr8246439ejc.263.1627116896884; Sat, 24 Jul 2021 01:54:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 2/9] target/i386: Added consistency checks for CR3 Date: Sat, 24 Jul 2021 10:54:46 +0200 Message-Id: <20210724085453.16791-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x635.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lara Lazier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117051751100001 Content-Type: text/plain; charset="utf-8" From: Lara Lazier All MBZ in CR3 must be zero (APM2 15.5) Added checks in both helper_vmrun and helper_write_crN. When EFER.LMA is zero the upper 32 bits needs to be zeroed. Signed-off-by: Lara Lazier Message-Id: <20210723112740.45962-1-laramglazier@gmail.com> Signed-off-by: Paolo Bonzini --- target/i386/tcg/sysemu/misc_helper.c | 7 +++++++ target/i386/tcg/sysemu/svm_helper.c | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/target/i386/tcg/sysemu/misc_helper.c b/target/i386/tcg/sysemu/= misc_helper.c index a2af2c9bba..d347af2a99 100644 --- a/target/i386/tcg/sysemu/misc_helper.c +++ b/target/i386/tcg/sysemu/misc_helper.c @@ -96,6 +96,13 @@ void helper_write_crN(CPUX86State *env, int reg, target_= ulong t0) cpu_x86_update_cr0(env, t0); break; case 3: + if ((env->efer & MSR_EFER_LMA) && + (t0 & ((~0UL) << env_archcpu(env)->phys_bits))) { + cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); + } + if (!(env->efer & MSR_EFER_LMA)) { + t0 &=3D 0xffffffffUL; + } cpu_x86_update_cr3(env, t0); break; case 4: diff --git a/target/i386/tcg/sysemu/svm_helper.c b/target/i386/tcg/sysemu/s= vm_helper.c index 4d64ec378e..145511d635 100644 --- a/target/i386/tcg/sysemu/svm_helper.c +++ b/target/i386/tcg/sysemu/svm_helper.c @@ -120,6 +120,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next= _eip_addend) uint32_t int_ctl; uint32_t asid; uint64_t new_cr0; + uint64_t new_cr3; uint64_t new_cr4; =20 cpu_svm_check_intercept_param(env, SVM_EXIT_VMRUN, 0, GETPC()); @@ -261,6 +262,11 @@ void helper_vmrun(CPUX86State *env, int aflag, int nex= t_eip_addend) if ((new_cr0 & CR0_NW_MASK) && !(new_cr0 & CR0_CD_MASK)) { cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); } + new_cr3 =3D x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, save= .cr3)); + if ((env->efer & MSR_EFER_LMA) && + (new_cr3 & ((~0UL) << cpu->phys_bits))) { + cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); + } new_cr4 =3D x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, save= .cr4)); if (new_cr4 & cr4_reserved_bits(env)) { cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC()); @@ -271,9 +277,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next= _eip_addend) =20 cpu_x86_update_cr0(env, new_cr0); cpu_x86_update_cr4(env, new_cr4); - cpu_x86_update_cr3(env, x86_ldq_phys(cs, - env->vm_vmcb + offsetof(struct vmcb, - save.cr3))); + cpu_x86_update_cr3(env, new_cr3); env->cr[2] =3D x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, save.cr2)); int_ctl =3D x86_ldl_phys(cs, --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162711717837252.87470730081145; Sat, 24 Jul 2021 01:59:38 -0700 (PDT) Received: from localhost ([::1]:48680 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DVR-00034U-8K for importer@patchew.org; Sat, 24 Jul 2021 04:59:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DQz-00033p-1o for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:05 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:40605) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DQx-0002u2-3h for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:00 -0400 Received: by mail-ej1-x62e.google.com with SMTP id hq13so7221193ejc.7 for ; Sat, 24 Jul 2021 01:54:58 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:54:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dnmkHMYKQc2LFh1O1HKjyWYtXTQnY6m+i7KWJhDlxvw=; b=ETTuISH1/OtXlpgueraJkdngcu/9hOcX8gitQAbDwH/WmimB0yoedqKIa/0Cu8h2rg C30EiPU2wvDuI8yf+ELvOgdEdbsJ/JZ8kiHw1Xzv8NzMwvLcUv6mHBapxj9/I15EjUTo w4iCpiSDa6xhIXHO+GdnkrcWdQPTBdwGc6oGHYZCh4AQetliEJAMcJo0HJ0ZUyCHDhYp Z6MZG9wMLV1gZMnA1hsh8BUmA2I4syMPosKrIRATKTsLjo7d9oUQSK6jLZ1Gk5Bw0kJU dkP7H7m+r/7KQ+niEeO3kqyfD54/5tNF7luuMFYR3UXxcAugioTgEFaYV6o1GwXMRASf LR+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dnmkHMYKQc2LFh1O1HKjyWYtXTQnY6m+i7KWJhDlxvw=; b=nIHThmq9OoNAgd8XaqPC58Hy1jYaeN2Zf+nC8QxIa8byot5+F/h9UI3a9lxnBBGCj7 wEvZJFq0UZYhUXCwj6KfjaerwcK+NyWkCHvF+NrEKBu4N4lD3nvA4DFCtm4OoLvuKp1z E6mP8Dal93teV6rExiXuPMIw7k0Ju9QGY/LvD27n8OjmRjo5Gpkvhj8F0X1sXvF8bFsl 0323DsG3jYv78BN13ShzK36QwR2tQwwTsVXuFl9RuS7OqGrwkyWRcdZXcPxLNgnxLxKz CgQ+8v3CiLQVuHhT8dAYsjDUWV/n5rMXGIBtkDXjF8YVUEVsPF5ut+xASylNhzqauUUq 18AA== X-Gm-Message-State: AOAM530J37yTn1lIoOCed6eXN2FYwLV5tkHiVnVyAV0N2Esv3MLdodEY R5IWjxtm4VyCo9KhWgcTNAa5uCl9XjPMvQ== X-Google-Smtp-Source: ABdhPJwMtTVYyxVWCOLzoqRWWQInBj8u3445e/m53sdnwUcgrzuIAcrazBmbhza/veAgYCo7b4GRDg== X-Received: by 2002:a17:906:4e85:: with SMTP id v5mr8178295eju.67.1627116897635; Sat, 24 Jul 2021 01:54:57 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 3/9] i386: do not call cpudef-only models functions for max, host, base Date: Sat, 24 Jul 2021 10:54:47 +0200 Message-Id: <20210724085453.16791-4-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexander Bulekov , Claudio Fontana Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117180215100001 Content-Type: text/plain; charset="utf-8" From: Claudio Fontana Some cpu properties have to be set only for cpu models in builtin_x86_defs, registered with x86_register_cpu_model_type, and not for cpu models "base", "max", and the subclass "host". These properties are the ones set by function x86_cpu_apply_props, (also including kvm_default_props, tcg_default_props), and the "vendor" property for the KVM and HVF accelerators. After recent refactoring of cpu, which also affected these properties, they were instead set unconditionally for all x86 cpus. This has been detected as a bug with Nested on AMD with cpu "host", as svm was not turned on by default, due to the wrongful setting of kvm_default_props via x86_cpu_apply_props, which set svm to "off". Rectify the bug introduced in commit "i386: split cpu accelerators" and document the functions that are builtin_x86_defs-only. Signed-off-by: Claudio Fontana Tested-by: Alexander Bulekov Fixes: f5cc5a5c ("i386: split cpu accelerators from cpu.c,"...) Resolves: https://gitlab.com/qemu-project/qemu/-/issues/477 Message-Id: <20210723112921.12637-1-cfontana@suse.de> Signed-off-by: Paolo Bonzini --- target/i386/cpu.c | 19 ++++++- target/i386/host-cpu.c | 13 +++-- target/i386/kvm/kvm-cpu.c | 105 ++++++++++++++++++++------------------ target/i386/tcg/tcg-cpu.c | 11 ++-- 4 files changed, 89 insertions(+), 59 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 48b55ebd0a..edb97ebbbe 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -4919,6 +4919,9 @@ static uint64_t x86_cpu_get_supported_feature_word(Fe= atureWord w, return r; } =20 +/* + * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. + */ void x86_cpu_apply_props(X86CPU *cpu, PropValue *props) { PropValue *pv; @@ -4931,7 +4934,11 @@ void x86_cpu_apply_props(X86CPU *cpu, PropValue *pro= ps) } } =20 -/* Apply properties for the CPU model version specified in model */ +/* + * Apply properties for the CPU model version specified in model. + * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. + */ + static void x86_cpu_apply_version_props(X86CPU *cpu, X86CPUModel *model) { const X86CPUVersionDefinition *vdef; @@ -4960,7 +4967,9 @@ static void x86_cpu_apply_version_props(X86CPU *cpu, = X86CPUModel *model) assert(vdef->version =3D=3D version); } =20 -/* Load data from X86CPUDefinition into a X86CPU object +/* + * Load data from X86CPUDefinition into a X86CPU object. + * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. */ static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model) { @@ -5051,6 +5060,12 @@ static void x86_register_cpu_model_type(const char *= name, X86CPUModel *model) type_register(&ti); } =20 + +/* + * register builtin_x86_defs; + * "max", "base" and subclasses ("host") are not registered here. + * See x86_cpu_register_types for all model registrations. + */ static void x86_register_cpudef_types(const X86CPUDefinition *def) { X86CPUModel *m; diff --git a/target/i386/host-cpu.c b/target/i386/host-cpu.c index 4ea9e354ea..10f8aba86e 100644 --- a/target/i386/host-cpu.c +++ b/target/i386/host-cpu.c @@ -150,13 +150,16 @@ void host_cpu_vendor_fms(char *vendor, int *family, i= nt *model, int *stepping) =20 void host_cpu_instance_init(X86CPU *cpu) { - uint32_t ebx =3D 0, ecx =3D 0, edx =3D 0; - char vendor[CPUID_VENDOR_SZ + 1]; + X86CPUClass *xcc =3D X86_CPU_GET_CLASS(cpu); =20 - host_cpuid(0, 0, NULL, &ebx, &ecx, &edx); - x86_cpu_vendor_words2str(vendor, ebx, edx, ecx); + if (xcc->model) { + uint32_t ebx =3D 0, ecx =3D 0, edx =3D 0; + char vendor[CPUID_VENDOR_SZ + 1]; =20 - object_property_set_str(OBJECT(cpu), "vendor", vendor, &error_abort); + host_cpuid(0, 0, NULL, &ebx, &ecx, &edx); + x86_cpu_vendor_words2str(vendor, ebx, edx, ecx); + object_property_set_str(OBJECT(cpu), "vendor", vendor, &error_abor= t); + } } =20 void host_cpu_max_instance_init(X86CPU *cpu) diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index bbe817764d..d95028018e 100644 --- a/target/i386/kvm/kvm-cpu.c +++ b/target/i386/kvm/kvm-cpu.c @@ -52,47 +52,6 @@ static bool kvm_cpu_realizefn(CPUState *cs, Error **errp) return host_cpu_realizefn(cs, errp); } =20 -/* - * KVM-specific features that are automatically added/removed - * from all CPU models when KVM is enabled. - * - * NOTE: features can be enabled by default only if they were - * already available in the oldest kernel version supported - * by the KVM accelerator (see "OS requirements" section at - * docs/system/target-i386.rst) - */ -static PropValue kvm_default_props[] =3D { - { "kvmclock", "on" }, - { "kvm-nopiodelay", "on" }, - { "kvm-asyncpf", "on" }, - { "kvm-steal-time", "on" }, - { "kvm-pv-eoi", "on" }, - { "kvmclock-stable-bit", "on" }, - { "x2apic", "on" }, - { "kvm-msi-ext-dest-id", "off" }, - { "acpi", "off" }, - { "monitor", "off" }, - { "svm", "off" }, - { NULL, NULL }, -}; - -void x86_cpu_change_kvm_default(const char *prop, const char *value) -{ - PropValue *pv; - for (pv =3D kvm_default_props; pv->prop; pv++) { - if (!strcmp(pv->prop, prop)) { - pv->value =3D value; - break; - } - } - - /* - * It is valid to call this function only for properties that - * are already present in the kvm_default_props table. - */ - assert(pv->prop); -} - static bool lmce_supported(void) { uint64_t mce_cap =3D 0; @@ -150,22 +109,70 @@ static void kvm_cpu_xsave_init(void) } } =20 +/* + * KVM-specific features that are automatically added/removed + * from cpudef models when KVM is enabled. + * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. + * + * NOTE: features can be enabled by default only if they were + * already available in the oldest kernel version supported + * by the KVM accelerator (see "OS requirements" section at + * docs/system/target-i386.rst) + */ +static PropValue kvm_default_props[] =3D { + { "kvmclock", "on" }, + { "kvm-nopiodelay", "on" }, + { "kvm-asyncpf", "on" }, + { "kvm-steal-time", "on" }, + { "kvm-pv-eoi", "on" }, + { "kvmclock-stable-bit", "on" }, + { "x2apic", "on" }, + { "kvm-msi-ext-dest-id", "off" }, + { "acpi", "off" }, + { "monitor", "off" }, + { "svm", "off" }, + { NULL, NULL }, +}; + +/* + * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. + */ +void x86_cpu_change_kvm_default(const char *prop, const char *value) +{ + PropValue *pv; + for (pv =3D kvm_default_props; pv->prop; pv++) { + if (!strcmp(pv->prop, prop)) { + pv->value =3D value; + break; + } + } + + /* + * It is valid to call this function only for properties that + * are already present in the kvm_default_props table. + */ + assert(pv->prop); +} + static void kvm_cpu_instance_init(CPUState *cs) { X86CPU *cpu =3D X86_CPU(cs); + X86CPUClass *xcc =3D X86_CPU_GET_CLASS(cpu); =20 host_cpu_instance_init(cpu); =20 - if (!kvm_irqchip_in_kernel()) { - x86_cpu_change_kvm_default("x2apic", "off"); - } else if (kvm_irqchip_is_split() && kvm_enable_x2apic()) { - x86_cpu_change_kvm_default("kvm-msi-ext-dest-id", "on"); + if (xcc->model) { + /* only applies to builtin_x86_defs cpus */ + if (!kvm_irqchip_in_kernel()) { + x86_cpu_change_kvm_default("x2apic", "off"); + } else if (kvm_irqchip_is_split() && kvm_enable_x2apic()) { + x86_cpu_change_kvm_default("kvm-msi-ext-dest-id", "on"); + } + + /* Special cases not set in the X86CPUDefinition structs: */ + x86_cpu_apply_props(cpu, kvm_default_props); } =20 - /* Special cases not set in the X86CPUDefinition structs: */ - - x86_cpu_apply_props(cpu, kvm_default_props); - if (cpu->max_features) { kvm_cpu_max_instance_init(cpu); } diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c index 238e3a9395..93a79a5741 100644 --- a/target/i386/tcg/tcg-cpu.c +++ b/target/i386/tcg/tcg-cpu.c @@ -111,7 +111,8 @@ static void tcg_cpu_xsave_init(void) } =20 /* - * TCG-specific defaults that override all CPU models when using TCG + * TCG-specific defaults that override cpudef models when using TCG. + * Only for builtin_x86_defs models initialized with x86_register_cpudef_t= ypes. */ static PropValue tcg_default_props[] =3D { { "vme", "off" }, @@ -121,8 +122,12 @@ static PropValue tcg_default_props[] =3D { static void tcg_cpu_instance_init(CPUState *cs) { X86CPU *cpu =3D X86_CPU(cs); - /* Special cases not set in the X86CPUDefinition structs: */ - x86_cpu_apply_props(cpu, tcg_default_props); + X86CPUClass *xcc =3D X86_CPU_GET_CLASS(cpu); + + if (xcc->model) { + /* Special cases not set in the X86CPUDefinition structs: */ + x86_cpu_apply_props(cpu, tcg_default_props); + } =20 tcg_cpu_xsave_init(); } --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627117315026238.10982175363813; Sat, 24 Jul 2021 02:01:55 -0700 (PDT) Received: from localhost ([::1]:55292 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DXe-0007bi-1F for importer@patchew.org; Sat, 24 Jul 2021 05:01:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DQz-00033y-8Y for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:05 -0400 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]:45882) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DQx-0002uk-Ni for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:01 -0400 Received: by mail-ej1-x636.google.com with SMTP id gt31so7100348ejc.12 for ; Sat, 24 Jul 2021 01:54:59 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=s/x+lZjsGxmSIRyJXZgD1ePtnkg9iHRZ5A8ReuiRV7c=; b=PwCeXag/cgPbgTdGMm/hp5SelkKw5grBvxgHtFQIROi+KV3xk4VlKAEhUE9RO3cLXz bNwvEclkbsVKI5VpDmj0CrKCF6qqV4mk1er7/i+rjh0q5I0MkhG5YUO/xXoO+0LGxK+K olGfAl701JpW+r5Uln+oB+VGcWJI4sVgGfwkraDlBRwVkttKb5is0fkMsKEmUAvw3OER GC9JGuqG602mAlX0X/nFLcwOEXpLaIrLOGDT25i1cMTYgLcIZlODcgYJEmWbYebIU6Qq IdLn+vpc9A7mpfTrJZG/w04itTBw/ZeWZElheFdbwYVTgkYiC1uhDFDY84aLKSqf/62s zWoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=s/x+lZjsGxmSIRyJXZgD1ePtnkg9iHRZ5A8ReuiRV7c=; b=aCFqBUNB67r21vBRSFxgq1OMEp79k68DW0Oe5oZiSNVcXL3PhL5R6zSM8jLFMepH5z wFbmEdeFbIEOML+xIivWjvlPipMGesP/o6LKofNvVwcIfyOItTw+KyReCS9+tWQZ2g/P 7H8d6eaYaU7HUy7pR1l61tPqNZAf9jqDp/qMR3NRTQ0BInWEEjCbuCZx7bFW1DeAkPrb mszG8DG/n95TtZwyKJ9KX9rnHRgwRVvb8whiymmn52xJDOP0Tg3lhZlBTQThPOiF8XCb RWP7KIr4G+9ycSIH0Wq3yrSFDN8wk3uFWVgRAx7QolEEc+kcYOH/qqBCmYqAW6rF0Gw8 Nj7Q== X-Gm-Message-State: AOAM530sHMVS3IBcd1yTsa84yUIlOlzF53zmqdvQLPrLeqnBkOJ2aUKb jyUrbEKvzIBgLU0fnTv4t1jsEhISsXmEiw== X-Google-Smtp-Source: ABdhPJxsIgmOCd5cOQjM4MEjgZL6dOOa3ZANKXVQFFg7/vPdoykB+Hdv4W07kdXpokXM624NwGgqRA== X-Received: by 2002:a17:906:a04f:: with SMTP id bg15mr8425651ejb.417.1627116898461; Sat, 24 Jul 2021 01:54:58 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 4/9] MAINTAINERS: Replace Eduardo as "Host Memory Backends" maintainer Date: Sat, 24 Jul 2021 10:54:48 +0200 Message-Id: <20210724085453.16791-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x636.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Igor Mammedov , Eduardo Habkost , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117315636100003 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Edurdo asked me to take over co-maintaining "Host Memory Backends" with Igor, as Eduardo has plenty of other things to look after. Thanks a lot Eduardo for your excellent work in the past! Cc: Peter Maydell Cc: Eduardo Habkost Cc: Igor Mammedov Cc: Paolo Bonzini Signed-off-by: David Hildenbrand Acked-by: Igor Mammedov Message-Id: <20210723100532.27353-2-david@redhat.com> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 4256ad1adb..420c8a48a1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2547,7 +2547,7 @@ S: Maintained F: net/netmap.c =20 Host Memory Backends -M: Eduardo Habkost +M: David Hildenbrand M: Igor Mammedov S: Maintained F: backends/hostmem*.c --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627117313118888.4084479301467; Sat, 24 Jul 2021 02:01:53 -0700 (PDT) Received: from localhost ([::1]:55158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DXc-0007WM-39 for importer@patchew.org; Sat, 24 Jul 2021 05:01:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DQz-00034B-R8 for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:05 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:47084) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DQy-0002vD-EW for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:01 -0400 Received: by mail-ed1-x52e.google.com with SMTP id f13so1954278edq.13 for ; Sat, 24 Jul 2021 01:55:00 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4cH3wLGEq0JKZCYj4wrESPa9iNTNaZZMev7mR0tXzRE=; b=AZual6B8sELJDka5QEyHi80tsdeq+dhEYUxDBJ6DQLSr7vvxa3HPNACafQ8FuhfMmd j4sgCQ4at+XkRtIZnW/lX2bUvPfBJ7vvm5JzDiQZ7tCx5W2LEza833hGbDlHbzeFTsNO ynEbcvmByA7UVtD+5JhfnqxWLOO5avjeqRLOZMuBmhPlAexMCkwIYtyYiQbE8JcG0v/4 2avuRrr5fsxA8oBC+DzZvRF/WB4ZwCc4TNBK07vbr6N1867zesT1HiqRceJhNYbtUUbV nTXHar+bb9hpA8e/FQ1Fskr2PafcO50witTi5Z7+8O3Mj5/qF2Kqxhe1eIoK4eDIXaXL /dow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=4cH3wLGEq0JKZCYj4wrESPa9iNTNaZZMev7mR0tXzRE=; b=K3vba1IyunEJwSYSRfrMsYSDQWwl7Kwugdi79+MMjJo14xFRmGI6zZyGHMoFMH2Ff9 7v5ar0FnkmSO5jLSuRuPcB8qWQUnBxqB+m50Atm9P5PTATJRhU6x6u8XSjxVaDhKuWQq K/Di3eqwz49z5AhR/0I7sCpUjqaV+65YGVR+muKJJb1pwEhH0rPqfX7cSdUBUjiHzgur zEYmH+0F3ffbJCHtwARlh8kDJ5C+8x7ATtb2RV541iO9IcfLxC5P+Va8RReHu11fsu5T imDudv3NIouhgjtF4pZsnJJYplS//phKj4JHBpNZmQeFRx7izmWIWBN+eL7tBvCXfqNY 5bLA== X-Gm-Message-State: AOAM532qbmtDoQBy4WWrWuknu0duO1+3Vzlh6qTy/iMWOBbeQMFpsBE/ vVT2dTQXAvH1ERYocAfw3+cv/I5cU2M6Sg== X-Google-Smtp-Source: ABdhPJxGoLEyFiBttubb+adNi0ZHHDjCMHyoejRjYDFd08PvnsrtL9RPznOmY34XbEMPvYsfUmT+Dg== X-Received: by 2002:aa7:d8c1:: with SMTP id k1mr10050413eds.28.1627116899209; Sat, 24 Jul 2021 01:54:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 5/9] MAINTAINERS: Add Peter Xu and myself as co-maintainer of "Memory API" Date: Sat, 24 Jul 2021 10:54:49 +0200 Message-Id: <20210724085453.16791-6-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x52e.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Peter Xu , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117315481100001 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Peter and myself volunteered to help out co-maintaining "Memory API" with Paolo, so let's update the MAINTAINERS file. Cc: Peter Maydell Cc: Paolo Bonzini Cc: Peter Xu Signed-off-by: David Hildenbrand Message-Id: <20210723100532.27353-3-david@redhat.com> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 420c8a48a1..190a90b541 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2452,6 +2452,8 @@ F: tests/tcg/multiarch/gdbstub/ =20 Memory API M: Paolo Bonzini +M: Peter Xu +M: David Hildenbrand S: Supported F: include/exec/ioport.h F: include/exec/memop.h --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627117177260342.56263363123287; Sat, 24 Jul 2021 01:59:37 -0700 (PDT) Received: from localhost ([::1]:48676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DVQ-000343-76 for importer@patchew.org; Sat, 24 Jul 2021 04:59:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DR0-00034D-Mx for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:05 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:39459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DQz-0002wQ-5P for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:02 -0400 Received: by mail-ed1-x533.google.com with SMTP id q13so4687681edr.6 for ; Sat, 24 Jul 2021 01:55:00 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:54:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VUJlrWl+4FB407CX+X2TbXRleCCYnj6iPIcXEGt1Hfc=; b=nE6o0tmGp3skkWH3OkhYhFd79YchpuoOMEUVfki4sVVy5sO8Fy6LGZU84+a03CWbHZ 6e02x9TdsUeB8Xy7X6K4NMPTUr08WYFnejFhWrCmGCZb1bc4bvmiQE093uJwWhbIOFO4 G9lc4HzLKtG3GMMFjRdXmuCgOVKVtODX9gbBCRGYZe7cX+7ldhcWjGS4iJra1tmQFGn2 su/Gtmbqwayk8HGnxHPU1GQy8FmGI1TE2MeyNuikYnpMhZ/+epM7TIw/Qz7D3SGPNvuu x2GSx7wN2WRVNUQuTL5y6i9U3z93am2gHmRXSdCPPIJDZxWacpyDqe+nqTrBjMqwQ96d otOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VUJlrWl+4FB407CX+X2TbXRleCCYnj6iPIcXEGt1Hfc=; b=rlQjQW7RjlBo1B4wSwzWEGXxCR+UxiXRglnuaEXkdfnUo0qWtsvIWis1OVOkAVkUYH 5xCq+pRua6zbNWZ34fAj1XoSHbdSmHwhLPGQKACOqh5RiZ948wSyX9d+RffYj5nmViL0 Q28nkIZyF0KZ89NXXT9zDIB8P7tvi7rk0/+3rX829Tn+rP/XPXT8eem7dIqiPd4tzxv+ m458vDsLSKThFlpb8aWDEn9g0A5OJ7w9/F6y/oA5wxxV+aArHYokcKrTeF+sHfSNX+t/ EZ4ca/U+sN2Q8+D1bUEMUWMgsWwCeAIDV3LNuglw4cnhkTXWLuNA0tmsLB6c9DTEwFHT LuXA== X-Gm-Message-State: AOAM533S6DoWKvwqRBL0ittQGbhq0VwJXvKj37PaIR6R8qs6r8NPEXhV 0pN+0ViWVdczRjFFI4s22WfNh4kC4oqTJQ== X-Google-Smtp-Source: ABdhPJxWKWzi7ERLRsDotpdgiCek1gRNLj/Zgrt6M7ruUdn45BVSsdJY4Csn5ChIWReEUF7MFxYoLQ== X-Received: by 2002:a05:6402:1385:: with SMTP id b5mr10178708edv.276.1627116899934; Sat, 24 Jul 2021 01:54:59 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 6/9] MAINTAINERS: Add memory_mapping.h and memory_mapping.c to "Memory API" Date: Sat, 24 Jul 2021 10:54:50 +0200 Message-Id: <20210724085453.16791-7-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x533.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Peter Xu , David Hildenbrand Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117178118100003 Content-Type: text/plain; charset="utf-8" From: David Hildenbrand Both files logically belong to "Memory API" and are not yet listed anywhere else explicitly. Let's add them to "Memory API". Cc: Peter Maydell Cc: Paolo Bonzini Cc: Peter Xu Signed-off-by: David Hildenbrand Acked-by: Peter Xu Message-Id: <20210723100532.27353-4-david@redhat.com> Signed-off-by: Paolo Bonzini --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 190a90b541..445f7fe2d1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2460,9 +2460,11 @@ F: include/exec/memop.h F: include/exec/memory.h F: include/exec/ram_addr.h F: include/exec/ramblock.h +F: include/sysemu/memory_mapping.h F: softmmu/dma-helpers.c F: softmmu/ioport.c F: softmmu/memory.c +F: softmmu/memory_mapping.c F: softmmu/physmem.c F: include/exec/memory-internal.h F: scripts/coccinelle/memory-region-housekeeping.cocci --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1627117176273616.356961727926; Sat, 24 Jul 2021 01:59:36 -0700 (PDT) Received: from localhost ([::1]:48528 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DVP-0002ya-9S for importer@patchew.org; Sat, 24 Jul 2021 04:59:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59984) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DR3-00034J-4U for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:05 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]:41663) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DQz-0002wv-SP for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:03 -0400 Received: by mail-ed1-x530.google.com with SMTP id h10so4672917edv.8 for ; Sat, 24 Jul 2021 01:55:01 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:55:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GunVyRx6o/LzyjiMTpXKLJjGGHesCVbnI05qmeGk7yE=; b=ZqqtHDDrhMf8Musblx1RDL7qgTSkVtVEapKW42Ey896oOY+yC/wOQbkJxOIfVLKTOC R+C9EmJ+ZZ+ALpzSm6f7yVp9d5yNkCo6pUlN9Pe1Jgc6JV65oGK+srU2G63Wu6JydzO6 Bx8l6ygNq637gHxpGGs6yuraDfegbcxkt58ylERkb45maR/hJVOQ2DpwRyHf0mF2K9Ti Jbc9BUljpXm3Xqtxh3bam/bQV/q+0NTNTEDeWwpUUDiQbXKGV4u3Lvg1yXUungXbwkcS Y3yI+JA5sIzZFnyxWJcSxsnXD69fJjL7Dec0gGmtlyQT3yo6F1tSEHN3/f3iU3t4Urm4 +1sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=GunVyRx6o/LzyjiMTpXKLJjGGHesCVbnI05qmeGk7yE=; b=bVkMrwPUcnMOzxGd/ZyyXg+pied3hTrwD4Cgg9yzTsQEwieqfysgca3wzjA7/anLCj SZGKxYToPs1V73a6jztn02P2nhzFWqicKZ5De8FBb8CesaGRR69J/S48STWs4xj4fz75 ET+3JUjNT2iYhH4tpFDAT5PXCdgI9IMsKGYJwsKbMaLWPzEsxFKSm1gFo8PTO1H4vOFs 61CQf2oi02QpPzsLw0v071pJCjnKnnmc/QHzLdA/4qdpG/d2F8OczE7VR/h1vG+fwcXL Siqt7bMsfmEDf2RtyStzPTM+JKH55HcY6zwQy0u287HpZq2Izbh8cVDQ3Dn9PmDhXiTg jB+A== X-Gm-Message-State: AOAM531gedx4soPW3cRXAv+3TR3Ml520SNZq9Xe94AbxpNyxAHgW9KJL ke5y3JCy9R2rDvJnuR0cE5JwOq+GEfl86w== X-Google-Smtp-Source: ABdhPJxwb9Er3NuCpmBjBba5wDZ/Nqvvg6gVbeJsYm+aPoR8deJOKSocBV6Iyvzf92ItWA7pSzdB9Q== X-Received: by 2002:aa7:d543:: with SMTP id u3mr10240780edr.37.1627116900647; Sat, 24 Jul 2021 01:55:00 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 7/9] gitlab: only let pages be published from default branch Date: Sat, 24 Jul 2021 10:54:51 +0200 Message-Id: <20210724085453.16791-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x530.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117178006100001 From: Daniel P. Berrang=C3=A9 GitLab will happily publish pages generated by the latest CI pipeline from any branch: https://docs.gitlab.com/ee/user/project/pages/introduction.html "Remember that GitLab Pages are by default branch/tag agnostic and their deployment relies solely on what you specify in .gitlab-ci.yml. You can limit the pages job with the only parameter, whenever a new commit is pushed to a branch used specifically for your pages." The current "pages" job is not limited, so it is happily publishing docs content from any branch/tag in qemu.git that gets pushed to. This means we're potentially publishing from the "staging" branch or worse from outdated "stable-NNN" branches This change restricts it to only publish from the default branch in the main repository. For contributor forks, however, we allow it to publish from any branch, since users will have arbitrarily named topic branches in flight at any time. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-Id: <20210723113051.2792799-1-berrange@redhat.com> Signed-off-by: Paolo Bonzini --- .gitlab-ci.d/buildtest.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 89df51517c..80b57b7082 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -663,6 +663,17 @@ build-tools-and-docs-debian: =20 # Prepare for GitLab pages deployment. Anything copied into the # "public" directory will be deployed to $USER.gitlab.io/$PROJECT +# +# GitLab publishes from any branch that triggers a CI pipeline +# +# For the main repo we don't want to publish from 'staging' +# since that content may not be pushed, nor do we wish to +# publish from 'stable-NNN' branches as that content is outdated. +# Thus we restrict to just the default branch +# +# For contributor forks we want to publish from any repo so +# that users can see the results of their commits, regardless +# of what topic branch they're currently using pages: image: $CI_REGISTRY_IMAGE/qemu/debian-amd64:latest stage: test @@ -681,3 +692,10 @@ pages: artifacts: paths: - public + rules: + - if: '$CI_PROJECT_NAMESPACE =3D=3D "qemu-project" && $CI_COMMIT_BRANC= H =3D=3D $CI_DEFAULT_BRANCH' + when: on_success + - if: '$CI_PROJECT_NAMESPACE =3D=3D "qemu-project"' + when: never + - if: '$CI_PROJECT_NAMESPACE !=3D "qemu-project"' + when: on_success --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162711718058932.89239953760534; Sat, 24 Jul 2021 01:59:40 -0700 (PDT) Received: from localhost ([::1]:48916 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DVT-0003EM-EO for importer@patchew.org; Sat, 24 Jul 2021 04:59:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DR5-00037X-9R for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:07 -0400 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]:41828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DR2-0002xl-T5 for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:07 -0400 Received: by mail-ej1-x62c.google.com with SMTP id hb6so7194446ejc.8 for ; Sat, 24 Jul 2021 01:55:02 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.55.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=apsZV/jk63RRSa9CWgPizBreq7ffCH5V2eZW0Cf/xqk=; b=ePPy2lkvwsLrjODQQOWi1XsxqIhAqeFkqXRhvgSkk3gOroYGYUDcdYQdedBpWvS5U/ TnR/6wTZBRf3S/uK/H/wdmEa55dyM/IGw3hQMhezimcqQ4ERkzBj96x1NaTBTQKzHpKP 2UQEaVLVC/iX7u14c84z1jjz9ZmBQ9xUGkMaP7ENs8HTl8OUUHcKmDYoHdswU61akKuP muP/WGWsIizw9Fz/3PJywX04q5MaG/dBXYkFfXWuR97HpK9jXFq4UJrpLvibpzot4nY0 x6ymKraWCj7ON21QUe8SU0DA1LRdT+X1M585meSeK5np0LBTiSXjW2gZTjHeulc6hwNs rX4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=apsZV/jk63RRSa9CWgPizBreq7ffCH5V2eZW0Cf/xqk=; b=hXMQfQ3gTM8ef+FvhX312CtKecDD8iwYl8v4FJ1bZHVBzBogkTjk/YYPjFfpwFD8en /FXVjlEty/MqTlHxX1Q4ihlyw5beJep3yCKqT0ldmK0HjUVqvww1ikLIsoWOYB92vXR7 xqBUND82JaVOnUpDvFY4mWQRUf5hHF8tovajHGK7DQLwX02A6X5DnyZskchcJeGFed5h D3AQPTjqmZg9gj1JGl5kojlC+g9JRAPYWk4O+4Ygw7QnAvNQ5oic0SwlvAji8A+vt/tf f18A/7rIGs43zugI9JvlnZFuD+5apKMBgopHHt7d9iTNXuvwDazqtuY/4/qs97j7CTER rQGw== X-Gm-Message-State: AOAM531NUZ9r/kw+v1xWd7JuPFx3Kp0Ux9FELx4lg6KwUKeK5ohxtbwZ m0UrybM3ee7zVQmVHp7MM4k1uWTCRrvpVQ== X-Google-Smtp-Source: ABdhPJxIHAmCphPOkuK/iKS5jxdPeXClBgwow9KLWccb94ewGlX15QDoI95r2ByFNVUdwt7EUFi7xA== X-Received: by 2002:a17:907:7683:: with SMTP id jv3mr8450379ejc.272.1627116901449; Sat, 24 Jul 2021 01:55:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 8/9] qapi: introduce forwarding visitor Date: Sat, 24 Jul 2021 10:54:52 +0200 Message-Id: <20210724085453.16791-9-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=paolo.bonzini@gmail.com; helo=mail-ej1-x62c.google.com X-Spam_score_int: 4 X-Spam_score: 0.4 X-Spam_bar: / X-Spam_report: (0.4 / 5.0 requ) DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Blake Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117182251100003 Content-Type: text/plain; charset="utf-8" This new adaptor visitor takes a single field of the adaptee, and exposes it with a different name. This will be used for QOM alias properties. Alias targets can of course have a different name than the alias property itself (e.g. a machine's pflash0 might be an alias of a property named 'drive'). When the target's getter or setter invokes the visitor, it will use a different name than what the caller expects, and the visitor will not be able to find it (or will consume erroneously). The solution is for alias getters and setters to wrap the incoming visitor, and forward the sole field that the target is expecting while renaming it appropriately. Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- include/qapi/forward-visitor.h | 27 +++ qapi/meson.build | 1 + qapi/qapi-forward-visitor.c | 326 ++++++++++++++++++++++++++++++ tests/unit/meson.build | 1 + tests/unit/test-forward-visitor.c | 197 ++++++++++++++++++ 5 files changed, 552 insertions(+) create mode 100644 include/qapi/forward-visitor.h create mode 100644 qapi/qapi-forward-visitor.c create mode 100644 tests/unit/test-forward-visitor.c diff --git a/include/qapi/forward-visitor.h b/include/qapi/forward-visitor.h new file mode 100644 index 0000000000..50fb3e9d50 --- /dev/null +++ b/include/qapi/forward-visitor.h @@ -0,0 +1,27 @@ +/* + * Forwarding visitor + * + * Copyright Red Hat, Inc. 2021 + * + * Author: Paolo Bonzini + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or l= ater. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#ifndef FORWARD_VISITOR_H +#define FORWARD_VISITOR_H + +#include "qapi/visitor.h" + +typedef struct ForwardFieldVisitor ForwardFieldVisitor; + +/* + * The forwarding visitor only expects a single name, @from, to be passed = for + * toplevel fields. It is converted to @to and forwarded to the @target v= isitor. + * Calls within a struct are forwarded without changing the name. + */ +Visitor *visitor_forward_field(Visitor *target, const char *from, const ch= ar *to); + +#endif diff --git a/qapi/meson.build b/qapi/meson.build index 376f4ceafe..c356a385e3 100644 --- a/qapi/meson.build +++ b/qapi/meson.build @@ -2,6 +2,7 @@ util_ss.add(files( 'opts-visitor.c', 'qapi-clone-visitor.c', 'qapi-dealloc-visitor.c', + 'qapi-forward-visitor.c', 'qapi-util.c', 'qapi-visit-core.c', 'qobject-input-visitor.c', diff --git a/qapi/qapi-forward-visitor.c b/qapi/qapi-forward-visitor.c new file mode 100644 index 0000000000..a4b111e22a --- /dev/null +++ b/qapi/qapi-forward-visitor.c @@ -0,0 +1,326 @@ +/* + * Forward Visitor + * + * Copyright (C) 2021 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU LGPL, version 2.1 or l= ater. + * See the COPYING.LIB file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qapi/compat-policy.h" +#include "qapi/error.h" +#include "qapi/forward-visitor.h" +#include "qapi/visitor-impl.h" +#include "qemu/queue.h" +#include "qapi/qmp/qjson.h" +#include "qapi/qmp/qbool.h" +#include "qapi/qmp/qdict.h" +#include "qapi/qmp/qerror.h" +#include "qapi/qmp/qlist.h" +#include "qapi/qmp/qnull.h" +#include "qapi/qmp/qnum.h" +#include "qapi/qmp/qstring.h" +#include "qemu/cutils.h" +#include "qemu/option.h" + +struct ForwardFieldVisitor { + Visitor visitor; + + Visitor *target; + char *from; + char *to; + + int depth; +}; + +static ForwardFieldVisitor *to_ffv(Visitor *v) +{ + return container_of(v, ForwardFieldVisitor, visitor); +} + +static bool forward_field_translate_name(ForwardFieldVisitor *v, const cha= r **name, + Error **errp) +{ + if (v->depth) { + return true; + } + if (g_str_equal(*name, v->from)) { + *name =3D v->to; + return true; + } + error_setg(errp, QERR_MISSING_PARAMETER, *name); + return false; +} + +static bool forward_field_check_struct(Visitor *v, Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + return visit_check_struct(ffv->target, errp); +} + +static bool forward_field_start_struct(Visitor *v, const char *name, void = **obj, + size_t size, Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + if (!visit_start_struct(ffv->target, name, obj, size, errp)) { + return false; + } + ffv->depth++; + return true; +} + +static void forward_field_end_struct(Visitor *v, void **obj) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + assert(ffv->depth); + ffv->depth--; + visit_end_struct(ffv->target, obj); +} + +static bool forward_field_start_list(Visitor *v, const char *name, + GenericList **list, size_t size, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + ffv->depth++; + return visit_start_list(ffv->target, name, list, size, errp); +} + +static GenericList *forward_field_next_list(Visitor *v, GenericList *tail, + size_t size) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + assert(ffv->depth); + return visit_next_list(ffv->target, tail, size); +} + +static bool forward_field_check_list(Visitor *v, Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + assert(ffv->depth); + return visit_check_list(ffv->target, errp); +} + +static void forward_field_end_list(Visitor *v, void **obj) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + assert(ffv->depth); + ffv->depth--; + visit_end_list(ffv->target, obj); +} + +static bool forward_field_start_alternate(Visitor *v, const char *name, + GenericAlternate **obj, size_t s= ize, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + /* + * The name passed to start_alternate is used also in the visit_type_*= calls + * that retrieve the alternate's content; so, do not increase depth he= re. + */ + return visit_start_alternate(ffv->target, name, obj, size, errp); +} + +static void forward_field_end_alternate(Visitor *v, void **obj) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + visit_end_alternate(ffv->target, obj); +} + +static bool forward_field_type_int64(Visitor *v, const char *name, int64_t= *obj, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_int64(ffv->target, name, obj, errp); +} + +static bool forward_field_type_uint64(Visitor *v, const char *name, + uint64_t *obj, Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_uint64(ffv->target, name, obj, errp); +} + +static bool forward_field_type_bool(Visitor *v, const char *name, bool *ob= j, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_bool(ffv->target, name, obj, errp); +} + +static bool forward_field_type_str(Visitor *v, const char *name, char **ob= j, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_str(ffv->target, name, obj, errp); +} + +static bool forward_field_type_size(Visitor *v, const char *name, uint64_t= *obj, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_size(ffv->target, name, obj, errp); +} + +static bool forward_field_type_number(Visitor *v, const char *name, double= *obj, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_number(ffv->target, name, obj, errp); +} + +static bool forward_field_type_any(Visitor *v, const char *name, QObject *= *obj, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_any(ffv->target, name, obj, errp); +} + +static bool forward_field_type_null(Visitor *v, const char *name, + QNull **obj, Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_type_null(ffv->target, name, obj, errp); +} + +static void forward_field_optional(Visitor *v, const char *name, bool *pre= sent) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, NULL)) { + *present =3D false; + return; + } + visit_optional(ffv->target, name, present); +} + +static bool forward_field_deprecated_accept(Visitor *v, const char *name, + Error **errp) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, errp)) { + return false; + } + return visit_deprecated_accept(ffv->target, name, errp); +} + +static bool forward_field_deprecated(Visitor *v, const char *name) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + if (!forward_field_translate_name(ffv, &name, NULL)) { + return false; + } + return visit_deprecated(ffv->target, name); +} + +static void forward_field_complete(Visitor *v, void *opaque) +{ + /* + * Do nothing, the complete method will be called in due time + * on the target visitor. + */ +} + +static void forward_field_free(Visitor *v) +{ + ForwardFieldVisitor *ffv =3D to_ffv(v); + + g_free(ffv->from); + g_free(ffv->to); + g_free(ffv); +} + +Visitor *visitor_forward_field(Visitor *target, const char *from, const ch= ar *to) +{ + ForwardFieldVisitor *v =3D g_new0(ForwardFieldVisitor, 1); + + /* + * Clone and dealloc visitors don't use a name for the toplevel + * visit, so they make no sense here. + */ + assert(target->type =3D=3D VISITOR_OUTPUT || target->type =3D=3D VISIT= OR_INPUT); + + v->visitor.type =3D target->type; + v->visitor.start_struct =3D forward_field_start_struct; + v->visitor.check_struct =3D forward_field_check_struct; + v->visitor.end_struct =3D forward_field_end_struct; + v->visitor.start_list =3D forward_field_start_list; + v->visitor.next_list =3D forward_field_next_list; + v->visitor.check_list =3D forward_field_check_list; + v->visitor.end_list =3D forward_field_end_list; + v->visitor.start_alternate =3D forward_field_start_alternate; + v->visitor.end_alternate =3D forward_field_end_alternate; + v->visitor.type_int64 =3D forward_field_type_int64; + v->visitor.type_uint64 =3D forward_field_type_uint64; + v->visitor.type_size =3D forward_field_type_size; + v->visitor.type_bool =3D forward_field_type_bool; + v->visitor.type_str =3D forward_field_type_str; + v->visitor.type_number =3D forward_field_type_number; + v->visitor.type_any =3D forward_field_type_any; + v->visitor.type_null =3D forward_field_type_null; + v->visitor.optional =3D forward_field_optional; + v->visitor.deprecated_accept =3D forward_field_deprecated_accept; + v->visitor.deprecated =3D forward_field_deprecated; + v->visitor.complete =3D forward_field_complete; + v->visitor.free =3D forward_field_free; + + v->target =3D target; + v->from =3D g_strdup(from); + v->to =3D g_strdup(to); + + return &v->visitor; +} diff --git a/tests/unit/meson.build b/tests/unit/meson.build index 3e0504dd21..5736d285b2 100644 --- a/tests/unit/meson.build +++ b/tests/unit/meson.build @@ -14,6 +14,7 @@ tests =3D { 'test-qobject-output-visitor': [testqapi], 'test-clone-visitor': [testqapi], 'test-qobject-input-visitor': [testqapi], + 'test-forward-visitor': [testqapi], 'test-string-input-visitor': [testqapi], 'test-string-output-visitor': [testqapi], 'test-opts-visitor': [testqapi], diff --git a/tests/unit/test-forward-visitor.c b/tests/unit/test-forward-vi= sitor.c new file mode 100644 index 0000000000..348f7e4e81 --- /dev/null +++ b/tests/unit/test-forward-visitor.c @@ -0,0 +1,197 @@ +/* + * QAPI Forwarding Visitor unit-tests. + * + * Copyright (C) 2021 Red Hat Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" + +#include "qemu-common.h" +#include "qapi/forward-visitor.h" +#include "qapi/qobject-input-visitor.h" +#include "qapi/error.h" +#include "qapi/qmp/qobject.h" +#include "qapi/qmp/qdict.h" +#include "test-qapi-visit.h" +#include "qemu/option.h" + +typedef bool GenericVisitor (Visitor *, const char *, void **, Error **); +#define CAST_VISIT_TYPE(fn) ((GenericVisitor *)(fn)) + +/* + * Parse @srcstr and wrap it with a ForwardFieldVisitor converting "src" to + * "dst". Check that visiting the result with "src" name fails, and return + * the result of visiting "dst". + */ +static void *visit_with_forward(const char *srcstr, GenericVisitor *fn) +{ + bool help =3D false; + QDict *src =3D keyval_parse(srcstr, NULL, &help, &error_abort); + Visitor *v, *alias_v; + Error *err =3D NULL; + void *result =3D NULL; + + v =3D qobject_input_visitor_new_keyval(QOBJECT(src)); + visit_start_struct(v, NULL, NULL, 0, &error_abort); + + alias_v =3D visitor_forward_field(v, "dst", "src"); + fn(alias_v, "src", &result, &err); + error_free_or_abort(&err); + assert(!result); + fn(alias_v, "dst", &result, &err); + assert(err =3D=3D NULL); + visit_free(alias_v); + + visit_end_struct(v, NULL); + visit_free(v); + qobject_unref(QOBJECT(src)); + return result; +} + +static void test_forward_any(void) +{ + QObject *src =3D visit_with_forward("src.integer=3D42,src.string=3DHel= lo,src.enum1=3Dvalue2", + CAST_VISIT_TYPE(visit_type_any)); + Visitor *v =3D qobject_input_visitor_new_keyval(src); + Error *err =3D NULL; + UserDefOne *dst; + + visit_type_UserDefOne(v, NULL, &dst, &err); + assert(err =3D=3D NULL); + visit_free(v); + + g_assert_cmpint(dst->integer, =3D=3D, 42); + g_assert_cmpstr(dst->string, =3D=3D, "Hello"); + g_assert_cmpint(dst->has_enum1, =3D=3D, true); + g_assert_cmpint(dst->enum1, =3D=3D, ENUM_ONE_VALUE2); + qapi_free_UserDefOne(dst); + qobject_unref(QOBJECT(src)); +} + +static void test_forward_size(void) +{ + /* + * visit_type_size does not return a pointer, so visit_with_forward + * cannot be used. + */ + bool help =3D false; + QDict *src =3D keyval_parse("src=3D1.5M", NULL, &help, &error_abort); + Visitor *v, *alias_v; + Error *err =3D NULL; + uint64_t result =3D 0; + + v =3D qobject_input_visitor_new_keyval(QOBJECT(src)); + visit_start_struct(v, NULL, NULL, 0, &error_abort); + + alias_v =3D visitor_forward_field(v, "dst", "src"); + visit_type_size(alias_v, "src", &result, &err); + error_free_or_abort(&err); + visit_type_size(alias_v, "dst", &result, &err); + assert(result =3D=3D 3 << 19); + assert(err =3D=3D NULL); + visit_free(alias_v); + + visit_end_struct(v, NULL); + visit_free(v); + qobject_unref(QOBJECT(src)); +} + +static void test_forward_number(void) +{ + /* + * visit_type_number does not return a pointer, so visit_with_forward + * cannot be used. + */ + bool help =3D false; + QDict *src =3D keyval_parse("src=3D1.5", NULL, &help, &error_abort); + Visitor *v, *alias_v; + Error *err =3D NULL; + double result =3D 0.0; + + v =3D qobject_input_visitor_new_keyval(QOBJECT(src)); + visit_start_struct(v, NULL, NULL, 0, &error_abort); + + alias_v =3D visitor_forward_field(v, "dst", "src"); + visit_type_number(alias_v, "src", &result, &err); + error_free_or_abort(&err); + visit_type_number(alias_v, "dst", &result, &err); + assert(result =3D=3D 1.5); + assert(err =3D=3D NULL); + visit_free(alias_v); + + visit_end_struct(v, NULL); + visit_free(v); + qobject_unref(QOBJECT(src)); +} + +static void test_forward_string(void) +{ + char *dst =3D visit_with_forward("src=3DHello", + CAST_VISIT_TYPE(visit_type_str)); + + g_assert_cmpstr(dst, =3D=3D, "Hello"); + g_free(dst); +} + +static void test_forward_struct(void) +{ + UserDefOne *dst =3D visit_with_forward("src.integer=3D42,src.string=3D= Hello", + CAST_VISIT_TYPE(visit_type_UserDe= fOne)); + + g_assert_cmpint(dst->integer, =3D=3D, 42); + g_assert_cmpstr(dst->string, =3D=3D, "Hello"); + g_assert_cmpint(dst->has_enum1, =3D=3D, false); + qapi_free_UserDefOne(dst); +} + +static void test_forward_alternate(void) +{ + AltStrObj *s_dst =3D visit_with_forward("src=3Dhello", + CAST_VISIT_TYPE(visit_type_AltSt= rObj)); + AltStrObj *o_dst =3D visit_with_forward("src.integer=3D42,src.boolean= =3Dtrue,src.string=3Dworld", + CAST_VISIT_TYPE(visit_type_AltSt= rObj)); + + g_assert_cmpint(s_dst->type, =3D=3D, QTYPE_QSTRING); + g_assert_cmpstr(s_dst->u.s, =3D=3D, "hello"); + g_assert_cmpint(o_dst->type, =3D=3D, QTYPE_QDICT); + g_assert_cmpint(o_dst->u.o.integer, =3D=3D, 42); + g_assert_cmpint(o_dst->u.o.boolean, =3D=3D, true); + g_assert_cmpstr(o_dst->u.o.string, =3D=3D, "world"); + + qapi_free_AltStrObj(s_dst); + qapi_free_AltStrObj(o_dst); +} + +static void test_forward_list(void) +{ + uint8List *dst =3D visit_with_forward("src.0=3D1,src.1=3D2,src.2=3D3,s= rc.3=3D4", + CAST_VISIT_TYPE(visit_type_uint8Li= st)); + uint8List *tmp; + int i; + + for (tmp =3D dst, i =3D 1; i <=3D 4; i++) { + g_assert(tmp); + g_assert_cmpint(tmp->value, =3D=3D, i); + tmp =3D tmp->next; + } + g_assert(!tmp); + qapi_free_uint8List(dst); +} + +int main(int argc, char **argv) +{ + g_test_init(&argc, &argv, NULL); + + g_test_add_func("/visitor/forward/struct", test_forward_struct); + g_test_add_func("/visitor/forward/alternate", test_forward_alternate); + g_test_add_func("/visitor/forward/string", test_forward_string); + g_test_add_func("/visitor/forward/size", test_forward_size); + g_test_add_func("/visitor/forward/number", test_forward_number); + g_test_add_func("/visitor/forward/any", test_forward_any); + g_test_add_func("/visitor/forward/list", test_forward_list); + + return g_test_run(); +} --=20 2.31.1 From nobody Sun May 12 12:14:58 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 162711705131925.557354813852612; Sat, 24 Jul 2021 01:57:31 -0700 (PDT) Received: from localhost ([::1]:40296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m7DTO-0005vs-3v for importer@patchew.org; Sat, 24 Jul 2021 04:57:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m7DR4-00036p-HG for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:06 -0400 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:37582) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m7DR2-0002yB-Sx for qemu-devel@nongnu.org; Sat, 24 Jul 2021 04:55:06 -0400 Received: by mail-ed1-x535.google.com with SMTP id h8so4697865ede.4 for ; Sat, 24 Jul 2021 01:55:03 -0700 (PDT) Received: from avogadro.lan ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id j21sm15723881edq.76.2021.07.24.01.55.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 01:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iAzRZTOU3CFNU4Er6w7cCoZipfLzLuXGgpPpVsUOjH0=; b=Lo/RhUsVgn3VPKLbr1G6IYFmrO/M1zgC2Cg5nvnGF5v1RXL4SgEK+X4dAHTLAUPU74 VVnYYxlWTSHnJxd7TCfHbf8HAijQj1D1QEKLUISpfPxAQHtpYkNCfi6axP+orvOdrrih xZX5Z9HtelqV62tDATb26eo3g0N/mmLnYfRe14tgLXCRFOKUPuXESlcyZzXEBUO7uARm jY09IrzdaHdVp93ffD6UcUzefL+3zb0+WwhLGaeYkaMY/Angz73WBvmHq36YR4sj9N+d ofi8WIgmQ5YXWSpMkCVcSgDzSK3wulP6U5yKSGQvOHpbmFwp8JAxrmAvyr9KOFKlQCSa v8Sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iAzRZTOU3CFNU4Er6w7cCoZipfLzLuXGgpPpVsUOjH0=; b=qxkoLSxIKDRkiI2zIx2VWyy1rpvDm2K7jjgPzICFKjRh4Wr+5nGafVxnxbJXK890WF xBZC9HSdo2ICn8GjR6WL/KUNzsK3IHKwmzh89XIUtdyoONvCQtcDC0kId7ShDnsGXx7h sDmTyc+odsUXDCytmeoo0v9DjdBNCFVhwJn7sr3r7IGgfNGGLXN27fXUypoKJNExeYAZ KTX8nvCPI89Po9qDFACb0D7kHBX+Pv1XREXCouiLgnqwrD0PzphzEDjUOqr6KBc5d022 BhVbLesscaUpvtyhItWXLPJLJ6LeDl5rzJiMFZCmqz2ApBSTB/AM2K/djxaEhNYjesKR /WOg== X-Gm-Message-State: AOAM531+jOnu2i93j30CvfwZODyGB+SgfNmOMlo9SvbMnFIIqEVgemqG ns4Kwbpsr/kJo4Mp3VSYPNsKU+cVPveFHA== X-Google-Smtp-Source: ABdhPJx58FpYAKtk38HPDo3s3NUTIxuEBJo6lGBrGRuCBUD9ejf/JDXfNx5PG37MBHrhXoJj2x29ag== X-Received: by 2002:a50:ff0a:: with SMTP id a10mr10200662edu.273.1627116902207; Sat, 24 Jul 2021 01:55:02 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PULL 9/9] qom: use correct field name when getting/setting alias properties Date: Sat, 24 Jul 2021 10:54:53 +0200 Message-Id: <20210724085453.16791-10-pbonzini@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210724085453.16791-1-pbonzini@redhat.com> References: <20210724085453.16791-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=paolo.bonzini@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Williamson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1627117053403100007 Content-Type: text/plain; charset="utf-8" Alias targets have a different name than the alias property itself (e.g. a machine's pflash0 might be an alias of a property named 'drive'). When the target's getter or setter invokes the visitor, it will use a different name than what the caller expects, and the visitor will not be able to find it (or will consume erroneously). The solution is for alias getters and setters to wrap the incoming visitor, and forward the sole field that the target is expecting while renaming it appropriately. This bug has been there forever, but it was exposed after -M parsing switched from QemuOptions and StringInputVisitor to keyval and QObjectInputVisitor. Before, the visitor ignored the name. Now, it checks "drive" against what was passed on the command line and finds that no such property exists. Fixes: https://gitlab.com/qemu-project/qemu/-/issues/484 Reported-by: Alex Williamson Signed-off-by: Paolo Bonzini --- qom/object.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qom/object.c b/qom/object.c index 6a01d56546..e86cb05b84 100644 --- a/qom/object.c +++ b/qom/object.c @@ -20,6 +20,7 @@ #include "qapi/string-input-visitor.h" #include "qapi/string-output-visitor.h" #include "qapi/qobject-input-visitor.h" +#include "qapi/forward-visitor.h" #include "qapi/qapi-builtin-visit.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qjson.h" @@ -2683,16 +2684,20 @@ static void property_get_alias(Object *obj, Visitor= *v, const char *name, void *opaque, Error **errp) { AliasProperty *prop =3D opaque; + Visitor *alias_v =3D visitor_forward_field(v, prop->target_name, name); =20 - object_property_get(prop->target_obj, prop->target_name, v, errp); + object_property_get(prop->target_obj, prop->target_name, alias_v, errp= ); + visit_free(alias_v); } =20 static void property_set_alias(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) { AliasProperty *prop =3D opaque; + Visitor *alias_v =3D visitor_forward_field(v, prop->target_name, name); =20 - object_property_set(prop->target_obj, prop->target_name, v, errp); + object_property_set(prop->target_obj, prop->target_name, alias_v, errp= ); + visit_free(alias_v); } =20 static Object *property_resolve_alias(Object *obj, void *opaque, --=20 2.31.1