From patchwork Fri Sep 15 19:00:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 723154 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp550154wro; Fri, 15 Sep 2023 12:00:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwyTaitONzhkn3DTsnqFqzzFfhZAyOWBgwxKcaVwuQGQ71nwishnBRzyBhY4RjCT9pIDlH X-Received: by 2002:ac8:594c:0:b0:403:ab73:9d55 with SMTP id 12-20020ac8594c000000b00403ab739d55mr3466388qtz.6.1694804438819; Fri, 15 Sep 2023 12:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694804438; cv=none; d=google.com; s=arc-20160816; b=xMIlZ1YNaCjQQ/y965J9ecZx56cR+/ElXkIQoiAKsFDcDMk8b8jlHEDYOqnSTpKai2 7M2MLNZ5H/7ZpcA6k+QXFl3bO6mcl3/wHbMMk8QXoRZOQ28t/ZbVRXCxRxjiszafiIZw oDHj4eoGLYKvkTCjS5UwFPc6WZOo50d3NSSWJ4Hv/XRcFviZArp5Y7lpgEBmZY5y7oot rfnhT0kbgAoCZ/X19NYDpGhEi3s9wDA8JYguLfQNJ7mwtebarKfmy5TxH61FlQJAxSHb 6YsWqVGMRmnChxq0XetBXAHwbHcy+Pk+qp6IqKcYyHppG06CxjEck8HZAW2lIvdie9zn 0Z4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z/oPseRALW5l8mhzSg1GPJ0x0BU257Ov4LZVxdjT9FU=; fh=waCo463KK/RPn5XMJMOOqmdDlsjWfqQaOVVDQpLbHvU=; b=eNVkcDDq6F0esb54Ue6n3fUehgSZiIEKjbLZ5hDTxp1S1/1gwvgEeOsOqt86J3D1jb 3exZ8JJ1F3zJgokqx7ZUCUykUEJ5x1UBLopalmyNqqm84VdjlVKAu4yr2iYa9r2jdcM1 oY+moAoJzGnbFx4FPdObzLJ+3TOakqCOCEbVOaUqtM7QQzEtkyTqaRVE4CBmrK4qjYv5 TPNxG67B2utUizSLlOudqWlTmb5yKPqvZUJA+nmdXFoWgmWtgCP8mLvonfGtPlzjMrr0 EOUNMTlZ5bHxHjkrE8m/4st60gFTWb2UwCapKkrV44Vbcq/7H4y/CaYMx++wRm2ELfEY n8lQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PslIBvQo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c13-20020ac87d8d000000b00410a28bece4si2863150qtd.350.2023.09.15.12.00.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 12:00:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PslIBvQo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3L-0005md-PT; Fri, 15 Sep 2023 15:00:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3C-0005lO-7F for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:30 -0400 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3A-0007U3-Ja for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:21 -0400 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-530a6cbbb47so664905a12.0 for ; Fri, 15 Sep 2023 12:00:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804418; x=1695409218; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Z/oPseRALW5l8mhzSg1GPJ0x0BU257Ov4LZVxdjT9FU=; b=PslIBvQoGzp4w8abC8mUdbENUG26RaBahvMc7ig3/DG9Ju2riqB/5NZe413CVd6605 qYG3j55vdrxL+DDFBTACoIxqDnSDOe/QSmp+QfE77DIridIyZ/+ZWT6Wkot71Z+bIfCJ USAZWM2X06x4/4ID1uCrLvEk/B/lNiUi3hnGkkLOqJdOXDp3faDeZGIm7XyWz73JH7jx QR4n8/biRD+cdGw6a9TK8OBaOmEIUDqD1WpANLHT+95mCDRT7VsMj0ZqPcI8tgJdgEJ8 kreggnZWbg+w7vsDSQusfOd4hMiVl9UXSEL1JPXTqx6xZTBoHTrrCYVjfOKxlutzr3GT k9iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804418; x=1695409218; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z/oPseRALW5l8mhzSg1GPJ0x0BU257Ov4LZVxdjT9FU=; b=iaHsTvpCa91G+vppLmG1K2A4kmEmFSOQTr3Xqqpv+BnW7XVFEnU0/vVtHg9oIQCNoE tJkGN2CLhaOPZE47Qy4HwR6ImyL3TXFtfJavZiRHj3SY9U8SkrjdjjKcZeBHPywT2Iqw T36DpliNcG4oLcZxna1vB0rHm1E35n0K4F7sko3IiSY8p4U1bhWEC+WGEOsHgl96r0I1 440RrT2XN7VisZ8HlRBNAj6k4mZzXVvWTCHvrEJvkq+oa3GDba3bg1U9YLujKVdp60hJ +jQKugC3vZKE+Y2qnav77E/U7/SILHhq2WAghCBxcdOSK4Pz4WDhLMOGrYb4SxssGTao OMdA== X-Gm-Message-State: AOJu0YwRLV/HnviB9LdAq5Ss274dSsNCJbA1h+QMS0Bd9Y8uQb08qh7q lhcZu7nPOoGFDwaomOrCgY9cpmDgWYRbyu8hzHI= X-Received: by 2002:aa7:caca:0:b0:523:387d:f5f1 with SMTP id l10-20020aa7caca000000b00523387df5f1mr2283637edt.24.1694804418561; Fri, 15 Sep 2023 12:00:18 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id i8-20020a0564020f0800b005309eb7544fsm890148eda.45.2023.09.15.12.00.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:18 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 1/5] accel: Rename accel_cpu_realizefn() -> accel_cpu_realize() Date: Fri, 15 Sep 2023 21:00:04 +0200 Message-ID: <20230915190009.68404-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=philmd@linaro.org; helo=mail-ed1-x52f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We use the '*fn' suffix for handlers, this is a public method. Drop the suffix. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Claudio Fontana --- include/qemu/accel.h | 4 ++-- accel/accel-common.c | 2 +- cpu.c | 2 +- target/i386/kvm/kvm-cpu.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index e84db2e3e5..cb64a07b84 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -90,11 +90,11 @@ void accel_setup_post(MachineState *ms); void accel_cpu_instance_init(CPUState *cpu); /** - * accel_cpu_realizefn: + * accel_cpu_realize: * @cpu: The CPU that needs to call accel-specific cpu realization. * @errp: currently unused. */ -bool accel_cpu_realizefn(CPUState *cpu, Error **errp); +bool accel_cpu_realize(CPUState *cpu, Error **errp); /** * accel_supported_gdbstub_sstep_flags: diff --git a/accel/accel-common.c b/accel/accel-common.c index df72cc989a..b953855e8b 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -119,7 +119,7 @@ void accel_cpu_instance_init(CPUState *cpu) } } -bool accel_cpu_realizefn(CPUState *cpu, Error **errp) +bool accel_cpu_realize(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); diff --git a/cpu.c b/cpu.c index 0769b0b153..61c9760e62 100644 --- a/cpu.c +++ b/cpu.c @@ -136,7 +136,7 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) /* cache the cpu class for the hotpath */ cpu->cc = CPU_GET_CLASS(cpu); - if (!accel_cpu_realizefn(cpu, errp)) { + if (!accel_cpu_realize(cpu, errp)) { return; } diff --git a/target/i386/kvm/kvm-cpu.c b/target/i386/kvm/kvm-cpu.c index 7237378a7d..4474689f81 100644 --- a/target/i386/kvm/kvm-cpu.c +++ b/target/i386/kvm/kvm-cpu.c @@ -35,7 +35,7 @@ static bool kvm_cpu_realizefn(CPUState *cs, Error **errp) * x86_cpu_realize(): * -> x86_cpu_expand_features() * -> cpu_exec_realizefn(): - * -> accel_cpu_realizefn() + * -> accel_cpu_realize() * kvm_cpu_realizefn() -> host_cpu_realizefn() * -> check/update ucode_rev, phys_bits, mwait */ From patchwork Fri Sep 15 19:00:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 723155 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp550459wro; Fri, 15 Sep 2023 12:01:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExVF+sYXrHVxYzqVuTbeCl6Wv5TlxF8pBOehljhG7o/ciJC2HC6fb5ReCeJzqDQpqUgg8a X-Received: by 2002:a67:fc4b:0:b0:44d:5718:d72a with SMTP id p11-20020a67fc4b000000b0044d5718d72amr2745976vsq.11.1694804465477; Fri, 15 Sep 2023 12:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694804465; cv=none; d=google.com; s=arc-20160816; b=cAFNksCBugfgTz5g/SFC4jyZLlVOIFwkhILWS80aykHGAPD/N9aY1b5l/jg48O8cQB 70SOHKyKs3TuE5cslqQKvjj7RnS196dF17KgOmvnGG5xJM905JXLOQdMV/zVhgWlOhRq 6RVtUQ76qlybjMS2qxwOFU73ZZPV03lMm3aMCBB4WrwgpFjMXo2Ittor5yYjzRWgdO60 zWyqtxfj89fus14+KBvjCBZQleGBTcLd1NKtCY7nK3DFhatIr4vWQHjk/UZHglIXD8ks N0pD1qOHppt67nHL1y3z0llCN812JCjYO3+Fv8GJFZ/+qhwYzea2jJO5kFF35LcDid1H Is7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yj/VmI3CWTgvZ6wzrxeZ+28cs5rrw6eKGcMTnrAf39k=; fh=waCo463KK/RPn5XMJMOOqmdDlsjWfqQaOVVDQpLbHvU=; b=UpUaqvwCUyD6kgi+ls88R2WilXm3cUsHbnOinep55bxrOb7+3Ph6fqJhhRFzHzpQGe Z6wrrl8RN8Ik9HDD+dSRgMamkASfXP349FMuR64g4JC9hUx91jj0uPdMSVWOge6VzqEw mdrNG2dBjoS9P2ljZTjMh3XR66des3QQRyfr2kEW6Buv+QIN16OrM+xrmQPUxUztRWdn wPcyCNOmIEO8tvK6b//VPUay2sECMFapm+MeKORet5KgziYuD29crsZAV6gvEOR+JHFS 4Mk83e65NwUCWfuuLwtgL4mQmDIEL99CKQNxK4Ht98kOFpzUizlEw/seoNFomUrtHa7l 29hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xUHo19+v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s3-20020a67ce03000000b0044acd048735si331661vsl.813.2023.09.15.12.01.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 12:01:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xUHo19+v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3P-0005n1-Sc; Fri, 15 Sep 2023 15:00:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3N-0005ml-Sa for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:33 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3H-0007YG-2O for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:33 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2bfbbd55158so39985661fa.1 for ; Fri, 15 Sep 2023 12:00:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804425; x=1695409225; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=yj/VmI3CWTgvZ6wzrxeZ+28cs5rrw6eKGcMTnrAf39k=; b=xUHo19+vptao8kqSuuUWv/Q39lEv+7Htw0FWGKlTZGLOuXPgNKFgtFmJ5VhU89TVDD UgSBqWuFWP1vpwH2Ew0HcQ9jY/7o7FgP2p1F4ZOiA4U+N9RT3olu50mAmAT3gmHFsXVg Wa9OxnS9upj/4r+qNkS6Bw0yEKwweBRkH1hfsr0/22H54na1maPE3pO6SkdsiYiDqeB9 9ZrBrNZg6PsLUrKf2Bq96Bji1erzBmAbwXhrSPqF57ok13WKdVutV+Gkw3HYZKjWN1Bv IKa2nMPKz1xWS04Qo4DJ/txBgBa3AjEBC70y5+zyhBS3RZ0eXz7C1mmDs/4TPSYi5g3M PSog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804425; x=1695409225; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yj/VmI3CWTgvZ6wzrxeZ+28cs5rrw6eKGcMTnrAf39k=; b=Q9bFmnSO6+YwlqxM5zP1qanSXm1dqGGmAoucw4t/u8zwFeP8jiNVeR6Zqkiog779Fd WAGW37OX5u3WCGJT9EMkwdHFqIRhH2iP7kiHLSjyksH4gfhZXlxgEhC6D7e+udYhxYQW dvouDytbFxaYyvATXVtVF1fXDvRAPookvMSJIUVv5hvIRLni5+RZ7aOExDRayXcXfiFB EBZpnLNqpw4Zr24WFi/j9bhIbUtmlOc2OyustNW90mJ94BtlemC5b4KJM6c7Vw3r8tdW ysDsty2UDBuToaj1/rMFLPC3LyXppY0TEe5z77U7GzdQqWhKZoDY8C+AI8ctSTRBgp+u fDgQ== X-Gm-Message-State: AOJu0Yzy4wsNP6qFJNo99Np73alNdsWaonJMlbRS+wLUhQLVCu9ExXSt 4j+DlJoTCVX2cggl7xZZ7202qMdEfOvAn2ta+Gs= X-Received: by 2002:a2e:3e0e:0:b0:2b6:bc30:7254 with SMTP id l14-20020a2e3e0e000000b002b6bc307254mr2206820lja.13.1694804424824; Fri, 15 Sep 2023 12:00:24 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id lc25-20020a170906dff900b0099bd86f9248sm2776714ejc.63.2023.09.15.12.00.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 2/5] accel: Introduce accel_cpu_unrealize() stub Date: Fri, 15 Sep 2023 21:00:05 +0200 Message-ID: <20230915190009.68404-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Prepare the stub for parity with accel_cpu_realize(). Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/accel.h | 6 ++++++ accel/accel-common.c | 4 ++++ cpu.c | 3 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index cb64a07b84..23254c6c9c 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -96,6 +96,12 @@ void accel_cpu_instance_init(CPUState *cpu); */ bool accel_cpu_realize(CPUState *cpu, Error **errp); +/** + * accel_cpu_unrealizefn: + * @cpu: The CPU that needs to call accel-specific cpu unrealization. + */ +void accel_cpu_unrealize(CPUState *cpu); + /** * accel_supported_gdbstub_sstep_flags: * diff --git a/accel/accel-common.c b/accel/accel-common.c index b953855e8b..cc3a45e663 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -129,6 +129,10 @@ bool accel_cpu_realize(CPUState *cpu, Error **errp) return true; } +void accel_cpu_unrealize(CPUState *cpu) +{ +} + int accel_supported_gdbstub_sstep_flags(void) { AccelState *accel = current_accel(); diff --git a/cpu.c b/cpu.c index 61c9760e62..b928bbed50 100644 --- a/cpu.c +++ b/cpu.c @@ -187,8 +187,9 @@ void cpu_exec_unrealizefn(CPUState *cpu) cpu_list_remove(cpu); /* * Now that the vCPU has been removed from the RCU list, we can call - * tcg_exec_unrealizefn, which may free fields using call_rcu. + * accel_cpu_unrealize, which may free fields using call_rcu. */ + accel_cpu_unrealize(cpu); if (tcg_enabled()) { tcg_exec_unrealizefn(cpu); } From patchwork Fri Sep 15 19:00:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 723156 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp550472wro; Fri, 15 Sep 2023 12:01:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdcu5W80dlYBJyjDv8Y5CLsadP5rN/AHiLxMZ0dC80OOScaBeHs4jOgDJIzxOoALyMbyM+ X-Received: by 2002:a67:b103:0:b0:44f:c528:6252 with SMTP id w3-20020a67b103000000b0044fc5286252mr2408818vsl.2.1694804465942; Fri, 15 Sep 2023 12:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694804465; cv=none; d=google.com; s=arc-20160816; b=yoZaj8hXsqTcPw2X2F5bhxWIGXrkxBCtKew5NTEsajDZwpiNOI2ZAZ3IL7BhTfv2Jq bDPjjhJL5d1p5NF7EEVJ5jR8lzIBUDvbprR2Mnr40eytOwnSQUsLVGM1Q+z0dpX0s4vo YfOIe236ryQRI1mWjlHtsCl9a22XDxHmlM9LVYUvGt0E4HPk4Ptghg6GD7mD96octR4h mmz8L2s8I7M4gBqDBDD3e9ixOTkWws0a4btZoKnL4xe+9cCv+2xmf8vSY206G/erk7VS x5wSpVYHMNArVk1x6D1Ij0gjYIJTvHWn2rYlG6jhFbmTSZKb5E+/keJRK2sL0AejcZb7 KUtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WDSY0XDObgkxUL7brWiUxnx3rvK0ibvXtjHunMwb0Ko=; fh=waCo463KK/RPn5XMJMOOqmdDlsjWfqQaOVVDQpLbHvU=; b=tJOt/T6cnDPP0ErF6Zod3kdhFi2N15W64QneApL6yUpZqTwqLpZpD8ofQghqZF+nr5 xi7/q17ivhNXFXZJHKX4lbficA52B30Y24TEUyN08oE5QMNZPTDxxwiI5YhD6astc9TS TxAd37hQNgN/Fj1kKPH6Br0zrEYgTHFihOvLcEKUt/YvZNgmXvAeBb7p4rsLJZyeroWm uFVF+gvqPjnRoztNflBtupQ60VDVjXxTQ/EYQe4UZ5LhrYM2bd5vcKG5VoBxWXWVxUd0 Mhwv5oRQjWy8r5AScgNKhJwS3ty8GFZ+c26ERY/fRKboN/uiy2QD2JhL6MrBI6RcLCuR E5Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TB8etVMh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n20-20020a67d614000000b0044d40c193fdsi351467vsj.410.2023.09.15.12.01.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 12:01:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TB8etVMh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3X-0005rO-51; Fri, 15 Sep 2023 15:00:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3R-0005nC-Kk for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:37 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3N-0007a6-To for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:36 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-9a645e54806so302825666b.0 for ; Fri, 15 Sep 2023 12:00:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804432; x=1695409232; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WDSY0XDObgkxUL7brWiUxnx3rvK0ibvXtjHunMwb0Ko=; b=TB8etVMhsM+4J4V2UVXxXPjrrXg4yXqt2v28ZznHuJ4DfAxUknz09wn7xBVbSn9Lv8 WtgdM3ggP1CYorgtkH+uhqACmZjf4oAYg6U+25ZA62gEmUOdyHdQJd5Qoi061m3Bw09C 3Ce9ISdU5sPdgjhiTpi6ZDAH1pLbmdQv6aEiKTOOkCWxyJx+a74sSh1Yw2b5a+nwl1wU sDSnUOlEulL9TavjUGZgETffQXPLxfxOr+drl1yGjQmz3PoUrD8AjybkOCmEF5U5NLsb m7QyFwNqEELCc/+skgLfQ/hrEdzWSuYOhLDfh4KBamA5RgC/1aXCqeCNWNIXYPUtSBPF c4ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804432; x=1695409232; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WDSY0XDObgkxUL7brWiUxnx3rvK0ibvXtjHunMwb0Ko=; b=OMJlpA9dAfaMAhh5X+kzd7H/ZnGUX+k2S1OwZuUZ/clAWVF0TIXe+A2iM2UhQxPpHw 3M3SPOqwGTz26Itynd/3XYPbl19jL/0pEDhX0Vf409AiLuzsMgw1VAxEegIRcsohHDRC XnzIB1qVnLmnKFCwhPCv0PcM6kGUCxAlb5/DZ69ETA88ulcKXZq/IAxm6qJ7vyjaNO8R 9mL3Kwthx4ytjqzmEUY6ocmJma9DbojPyxANnBV7Z59HPhFepehdA3RhK13cfDJQC8sG 4u3AEmUQpuE1ElgZRXO6k5/KfC2kuJ1G86Mm5Zb6J8twYJtAjJje9FeDbfg6a7bJZFyF P/2Q== X-Gm-Message-State: AOJu0Yy4u7QdV8LpMBnM64reggdUmxlSURxp8kY5TpomejQpNf88DY7v X4od96BxPQS3nzPC8AZpNmq3e1y2QOtpNU2NrA8= X-Received: by 2002:a17:906:76cc:b0:9a1:ddb9:654f with SMTP id q12-20020a17090676cc00b009a1ddb9654fmr1957052ejn.55.1694804432309; Fri, 15 Sep 2023 12:00:32 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id lg13-20020a170906f88d00b009828e26e519sm2750934ejb.122.2023.09.15.12.00.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:31 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 3/5] accel: Declare AccelClass::[un]realize_cpu() handlers Date: Fri, 15 Sep 2023 21:00:06 +0200 Message-ID: <20230915190009.68404-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::631; envelope-from=philmd@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Currently accel_cpu_realize() only performs target-specific realization. Introduce the [un]realize_cpu fields in the base AccelClass to be able to perform target-agnostic [un]realization of vCPUs. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/accel.h | 2 ++ accel/accel-common.c | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 23254c6c9c..7bd9907d2a 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -43,6 +43,8 @@ typedef struct AccelClass { bool (*has_memory)(MachineState *ms, AddressSpace *as, hwaddr start_addr, hwaddr size); #endif + bool (*realize_cpu)(CPUState *cpu, Error **errp); + void (*unrealize_cpu)(CPUState *cpu); /* gdbstub related hooks */ int (*gdbstub_supported_sstep_flags)(void); diff --git a/accel/accel-common.c b/accel/accel-common.c index cc3a45e663..6d427f2b9d 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -122,15 +122,32 @@ void accel_cpu_instance_init(CPUState *cpu) bool accel_cpu_realize(CPUState *cpu, Error **errp) { CPUClass *cc = CPU_GET_CLASS(cpu); + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); - if (cc->accel_cpu && cc->accel_cpu->cpu_realizefn) { - return cc->accel_cpu->cpu_realizefn(cpu, errp); + /* target specific realization */ + if (cc->accel_cpu && cc->accel_cpu->cpu_realizefn + && !cc->accel_cpu->cpu_realizefn(cpu, errp)) { + return false; } + + /* generic realization */ + if (acc->realize_cpu && !acc->realize_cpu(cpu, errp)) { + return false; + } + return true; } void accel_cpu_unrealize(CPUState *cpu) { + AccelState *accel = current_accel(); + AccelClass *acc = ACCEL_GET_CLASS(accel); + + /* generic unrealization */ + if (acc->unrealize_cpu) { + acc->unrealize_cpu(cpu); + } } int accel_supported_gdbstub_sstep_flags(void) From patchwork Fri Sep 15 19:00:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 723157 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp550795wro; Fri, 15 Sep 2023 12:01:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IET6okQ7JjAgw6fEzUaCQojX+A2ldLjfcTWBD1M9mwkdG07HbQaKcsugVLiee4bzjm3P/j/ X-Received: by 2002:a05:6102:2cf:b0:44d:4f8f:d8e5 with SMTP id h15-20020a05610202cf00b0044d4f8fd8e5mr2826538vsh.20.1694804491059; Fri, 15 Sep 2023 12:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694804491; cv=none; d=google.com; s=arc-20160816; b=VZ0EPYSVUAJlQiGjPKCcyHijnTrQagTyQe2RVgDcuX3Px4qy6u7sczY3OTFrd257G1 sTKIxJdc7Z9NoQovhU/pN4pKHVQW1GTmGC1oHQ9F6mSkdsJNDgxti5uJmhHMWQf8FY+i wecKPBdRzfxVflH4T6GZQuv2xZvQow+zc1MBu6Km4RZSGnGwr+Q3VUSKMzw6sqXKujcm qr2/uDNHEAkz45m+rqE1UUZXbLpcj4GOLrQF8gcSJfC54hAh9I/PAo4UsspwJuG51eGV Al074LWy7grWg0YEX2lkl7CaLVKyrLNTBkr3Cb19Yj8XTfTu3khZIFI8ba7IU6qyK2IX 6tBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YgOXTjMw7CegRZgzm9gZgaFqpfOBfIJY+75/jhEK298=; fh=waCo463KK/RPn5XMJMOOqmdDlsjWfqQaOVVDQpLbHvU=; b=0/X1OpZxz8gVQvBlXAXx0i9TfcLpRJa2lXxHfHAdX4OgtNQ3PDfK7B1Kgg0kQa4Nfj dHIbxMucAT1giTU24b+UGBnbglXhAg7+tA646TxYJOdzbYGWGRuGCW6FuKZ5gfu/4quM DnMuWr75UGYeLnpQbzV3u9+5++AUUTUpRxMAqHlPGAbfOeh9tphbwezn3ubUn7u2EB6N sMfRHYn/RCEkXicUkKeS/8YK4AAyESZ75ZwVbOJ+CFMDZGj48eal3xEbuWarDSye35wQ +gM6Acgt7xYIDyhtNsGBH+5+K9K8BCxfOp0do+ihR86K4l7aCPPO44RF22PXNc02dzNy +uKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWx2AxDe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y16-20020a67d210000000b0044d3bf9bf1esi336131vsi.426.2023.09.15.12.01.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 12:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWx2AxDe; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3b-0006BB-OF; Fri, 15 Sep 2023 15:00:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3Z-0005vO-9e for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:45 -0400 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3V-0007aa-6r for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:44 -0400 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2bce552508fso38491171fa.1 for ; Fri, 15 Sep 2023 12:00:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804439; x=1695409239; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=YgOXTjMw7CegRZgzm9gZgaFqpfOBfIJY+75/jhEK298=; b=JWx2AxDeZ3UH9Iq0gpA8RIRY8gMaBrdwU6/Xx8/b8xL1/dwSfJ9eLvsMucVCx54fiA RJLSgkRWl3qODJ7vDHw/C+8dcZiGw836fwSXeJbHRk5pfu89OlrZ9HWW2n6kYlp7IEYd 3oNxN8Y2ygWTmZeJ2vU1TbjwR82gqZWwksmWwl+kFgIGhQLNQdBoq2c7k8nPKmakJXvo MXxE1zsgiS1PL1A/4RGVXbfGPOiUlHFMeBHlmOwxCwENh8BPEHYS90cnO6pvOpgrijf4 IqOJaalDnfM7BUGy1IAZ+hZH++eM+HcfDc+R5L3a9BLaMMywtuH4zscU98jlvZrLSOLV 5r+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804439; x=1695409239; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YgOXTjMw7CegRZgzm9gZgaFqpfOBfIJY+75/jhEK298=; b=Ii/w0Ddlv3pWmz6m2Odb8KVF/+sVYJiWX/T9RCpVUE/wdohQGgS7/SZXAqgLByNkHy VUu7VPRYUzAqGW56kGjOqRpkqKKrNoMudFNMzVp6j+RAFP/1h13iAY+NVgdYo+EpqQjJ 0jLuZABsvUzBuAKyTXo1u/9Tdp6BnkjZWl36qqcuv7O155cLFyqBLy2DzctlBTVai+TG 437J3rDnfy9QmWZbO0P9QxgeKn6s4l8pUFOUiHbJTki3gLlvQK06kGPbIpqs8RijBobR DLZTgId945VSqwwA/4iQE6PhiB/SRU9BdKHwhJu4ljMFvRFYkY0oFowZ5J7SrXp2WHeX My4w== X-Gm-Message-State: AOJu0YwJjisL7fTmuB41CQme/cpCqLsyKYmODy7dQGfpGdckODR/M1Cj yi7rKRPzGp7tOXb0Ow4M4EFIjxbx3/JPuUK4EsU= X-Received: by 2002:a2e:b001:0:b0:2bc:b46b:686b with SMTP id y1-20020a2eb001000000b002bcb46b686bmr2330235ljk.34.1694804438711; Fri, 15 Sep 2023 12:00:38 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id l21-20020a1709061c5500b009ad89697c86sm2771684ejg.144.2023.09.15.12.00.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:38 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 4/5] accel/tcg: Have tcg_exec_realizefn() return a boolean Date: Fri, 15 Sep 2023 21:00:07 +0200 Message-ID: <20230915190009.68404-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=philmd@linaro.org; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Following the example documented since commit e3fe3988d7 ("error: Document Error API usage rules"), have tcg_exec_realizefn() return a boolean indicating whether an error is set or not. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Claudio Fontana --- include/exec/cpu-all.h | 2 +- accel/tcg/cpu-exec.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index c2c62160c6..1e5c530ee1 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -422,7 +422,7 @@ void dump_exec_info(GString *buf); /* accel/tcg/cpu-exec.c */ int cpu_exec(CPUState *cpu); -void tcg_exec_realizefn(CPUState *cpu, Error **errp); +bool tcg_exec_realizefn(CPUState *cpu, Error **errp); void tcg_exec_unrealizefn(CPUState *cpu); /** diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e2c494e75e..fa97e9f191 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -1088,7 +1088,7 @@ int cpu_exec(CPUState *cpu) return ret; } -void tcg_exec_realizefn(CPUState *cpu, Error **errp) +bool tcg_exec_realizefn(CPUState *cpu, Error **errp) { static bool tcg_target_initialized; CPUClass *cc = CPU_GET_CLASS(cpu); @@ -1104,6 +1104,8 @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp) tcg_iommu_init_notifier_list(cpu); #endif /* !CONFIG_USER_ONLY */ /* qemu_plugin_vcpu_init_hook delayed until cpu_index assigned. */ + + return true; } /* undo the initializations in reverse order */ From patchwork Fri Sep 15 19:00:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 723158 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp551064wro; Fri, 15 Sep 2023 12:01:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHHWoEZozTseBbbZk0Rhg8XxLVmjQuPuaU/G5hK+vWL5kWGRbDbHEBsiIoBGRfnpNN8o5UO X-Received: by 2002:a05:6102:222c:b0:450:985f:ef28 with SMTP id d12-20020a056102222c00b00450985fef28mr3297028vsb.5.1694804514631; Fri, 15 Sep 2023 12:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694804514; cv=none; d=google.com; s=arc-20160816; b=Sm1YE2JhpBqzkZL/ptH5WkbGe9bTmiTn03D7RuChyMguvtnAmoNLVzxbMn+Ar9UoVw cXcMqzpSoxGEyOgHNyvGuDPCtiw/PjZrR56I2rhfN77skWFqBPC5AmlVOB+97KLkPbR/ S9gNH6Az1dVDCoVI9Yc7B2CzQlKwhATdS2rtYki83d5jD8+P0kk3oP72s4xyIvx0g48P Bkyt9p7vz9zf56qPUA2HqQS7NTp7u7J50itIS3t9HGi04IMdtWoOFIanbqrUwnmkn1aG f22Yr/eryWFwqt7BmoIJ6gq0hAJ0TjI09G99ZpahAEzElhA9sK3Coa2N9EVHgF98agTH xBeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oOpx/VA/+gwdtEbnTetIr2FQsXveadRswnAsnH4GXos=; fh=waCo463KK/RPn5XMJMOOqmdDlsjWfqQaOVVDQpLbHvU=; b=Wf7S8Pp52PQOROsEdIFSLy1VoHFG4r1b/cNa6OXnAqtAqxcsHhSq3hiqpZ074dAxln +DevJsC2NSCqw8C8ma5+i6KYN324PySrFvM5Jdg4jxWdYRgeccALsW5ZjvaLFQKzVK03 4O3OoVU+sUPTaJ8kM4tptIS7NO65lUoZRfgEDQc8MPBH0oIhkHYsMOsmPZ7F6xka9Ji0 MqZrWouMwbT3KeXpzwShENBskvxs1hPWfKgQmCio60+T3GVPpGetsby3YK4M1zP3mBU6 TR2fX3Hd6Kq3m7gQR0VAKxaQLKRCx5pRml1/w06ibFKtO2oxTdTc5wd+HDcJSvsvnD8S fb4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T5WE8C4v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ce10-20020a056130110a00b0078f479ce0dbsi310294uab.139.2023.09.15.12.01.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 12:01:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T5WE8C4v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qhE3r-0006Ua-EY; Fri, 15 Sep 2023 15:01:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qhE3j-0006L0-72 for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:56 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhE3d-0007cx-RJ for qemu-devel@nongnu.org; Fri, 15 Sep 2023 15:00:52 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9aa0495f9cfso775997966b.1 for ; Fri, 15 Sep 2023 12:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694804448; x=1695409248; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oOpx/VA/+gwdtEbnTetIr2FQsXveadRswnAsnH4GXos=; b=T5WE8C4vlwgDcx4Ksk2YfPYahMDkzzf8R18h0z3+Y9S0iZsEOin7R9QRGlogT4hKI9 MlkhNKsMCoM358ZWvUEOwVYQXa4oXQQgaGvAKebkmv4YDxIA1gL7WNzmhdpc115g4bVE S4Bn9ksR5OsX7HAZLkhq/WFfWjW7tz/1nsPtKd23sXEV/+B2H5bfd+zRIqwcEkDfVwC2 oRk60ibugg8HFH8du0ZBsu8AH/vGbXdMp/V73K7u118uLdFZGFR0sgO+c/A140pzS6Jq hfBTcbIrgaWCFX6lU4t7pwMN05CiyKbXL3WrSqR2jLzD/r7kkjRc2ZTQp7BcjspAcidV PJ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694804448; x=1695409248; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oOpx/VA/+gwdtEbnTetIr2FQsXveadRswnAsnH4GXos=; b=qbkuZpEn/G5+D4robAls3HyqfV9BS42krPA8UVblwpIY1KMB9SX3pDD9ErXeoQEkgt HzM1BnbcQ9RALqFWvIN+ccFkH1K7Q+y1pkIpGYatQERQBrrL5AiL7jCvrUtGDNOL5xer 2cQ1NuAYnWEApOXlXQAIARS92HjhlizVZ+h4JfjCTdEjj740GjAsdIRtt29nAbDMdkT4 E0qME5XrbMps2vzxr3wf/80Bu2mc4LtxtLwKYGqBw4opsVoIVEtLmBgTTA395II0EBY0 CeswzXwkuYubWzZfHseo36Jfsuz05HWdOorEFn/xC9cPVLTBNuoUwFsYmuD3HggJUAuo NGEg== X-Gm-Message-State: AOJu0YxruCXpUy08ey8r+YsLWPZ/JW0ix3VbGzLkZC+zFmMPP5+2KZP6 C9nqqKeBOxII4CABb7aMzmMyWjKXIlUuzS8rz/I= X-Received: by 2002:a17:907:3f91:b0:9a5:b247:3ab with SMTP id hr17-20020a1709073f9100b009a5b24703abmr9362665ejc.19.1694804445231; Fri, 15 Sep 2023 12:00:45 -0700 (PDT) Received: from m1x-phil.lan (6lp61-h01-176-171-209-234.dsl.sta.abo.bbox.fr. [176.171.209.234]) by smtp.gmail.com with ESMTPSA id mf13-20020a170906cb8d00b0099caf5bed64sm2735321ejb.57.2023.09.15.12.00.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 15 Sep 2023 12:00:44 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Fabiano Rosas , Marcelo Tosatti , Claudio Fontana , Eduardo Habkost , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Yanan Wang , Paolo Bonzini , Marcel Apfelbaum Subject: [PATCH 5/5] accel/tcg: Restrict tcg_exec_[un]realizefn() to TCG Date: Fri, 15 Sep 2023 21:00:08 +0200 Message-ID: <20230915190009.68404-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230915190009.68404-1-philmd@linaro.org> References: <20230915190009.68404-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=philmd@linaro.org; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We don't need to expose these TCG-specific methods to the whole code base. Register them as AccelClass handlers, they will be called by the generic accel_cpu_[un]realize() methods. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Claudio Fontana --- accel/tcg/internal.h | 3 +++ include/exec/cpu-all.h | 2 -- accel/tcg/tcg-all.c | 2 ++ cpu.c | 8 -------- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index e8cbbde581..57ab397df1 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -80,6 +80,9 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc); void cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb, uintptr_t host_pc); +bool tcg_exec_realizefn(CPUState *cpu, Error **errp); +void tcg_exec_unrealizefn(CPUState *cpu); + /* Return the current PC from CPU, which may be cached in TB. */ static inline vaddr log_pc(CPUState *cpu, const TranslationBlock *tb) { diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h index 1e5c530ee1..230525ebf7 100644 --- a/include/exec/cpu-all.h +++ b/include/exec/cpu-all.h @@ -422,8 +422,6 @@ void dump_exec_info(GString *buf); /* accel/tcg/cpu-exec.c */ int cpu_exec(CPUState *cpu); -bool tcg_exec_realizefn(CPUState *cpu, Error **errp); -void tcg_exec_unrealizefn(CPUState *cpu); /** * cpu_set_cpustate_pointers(cpu) diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c index 03dfd67e9e..6942a9766a 100644 --- a/accel/tcg/tcg-all.c +++ b/accel/tcg/tcg-all.c @@ -227,6 +227,8 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data) AccelClass *ac = ACCEL_CLASS(oc); ac->name = "tcg"; ac->init_machine = tcg_init_machine; + ac->realize_cpu = tcg_exec_realizefn; + ac->unrealize_cpu = tcg_exec_unrealizefn; ac->allowed = &tcg_allowed; ac->gdbstub_supported_sstep_flags = tcg_gdbstub_supported_sstep_flags; diff --git a/cpu.c b/cpu.c index b928bbed50..1a8e730bed 100644 --- a/cpu.c +++ b/cpu.c @@ -140,11 +140,6 @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp) return; } - /* NB: errp parameter is unused currently */ - if (tcg_enabled()) { - tcg_exec_realizefn(cpu, errp); - } - /* Wait until cpu initialization complete before exposing cpu. */ cpu_list_add(cpu); @@ -190,9 +185,6 @@ void cpu_exec_unrealizefn(CPUState *cpu) * accel_cpu_unrealize, which may free fields using call_rcu. */ accel_cpu_unrealize(cpu); - if (tcg_enabled()) { - tcg_exec_unrealizefn(cpu); - } } /*