From patchwork Fri Jun 20 17:13:22 2025 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: 898374 Delivered-To: patch@linaro.org Received: by 2002:a5d:5f54:0:b0:3a4:ee3f:8f15 with SMTP id cm20csp1560544wrb; Fri, 20 Jun 2025 15:20:24 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX/BZFi4LHDeTe4NDpZpPcvXgjw1KcwhO82inSf/OZbp90cCfT63RM6B1VKf3ONdiZGu84TjA==@linaro.org X-Google-Smtp-Source: AGHT+IFCfqPZwB1KvKuKgIzYEo9XuImPUc1Z8bXHXsAuGmTZM4jxvn8QrF3pfdNdT7gy0KdLE4fc X-Received: by 2002:a05:6214:4d08:b0:6fb:6129:d6f5 with SMTP id 6a1803df08f44-6fd0c969f71mr52087606d6.16.1750458024452; Fri, 20 Jun 2025 15:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1750458024; cv=none; d=google.com; s=arc-20240605; b=JRtelidclcY0/rWzOU62mkVtXcsgucR6iABbaDreJxSLg1wD407xT/naaFF41FDDS/ MUS3YQ+z1jUuuyHNiD7iKJ66f7/jxpsCOCoMej6wCVt6fMNlk5wflro/0ubdvtkRujJD L7JdE5bThENhdIlCQyOX5BJifPgs1GL+2v8Z3uCifOtkpjSaoi5MxtOZvj2kPpdhpVSa 6GQrDK4frwMYm2m6GMYDOjNX42s2hB4ggnNq5HvuhGleOy4R1ppoC5Zl9hpGzVZ73PU+ d+nw5+D8Bm5nw3NE3+T5KOOgWKk1JmjJ8xH6bv4goMmdr0aaOuHrP5G5D2PsEmNL/FrC 9cMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=IJ9HzRGq2YkLK75aks6LUHy4qRCZf2MFv/UyfZ7+gZE=; fh=8f2AL0Su0K9UlZksY2EEcc9O+An+AQ/T/SEdbs2pdSA=; b=jz2Ke0BSrB0XdYYydytH3rOYFW3WoUraEzml4Mxl02VO0G5Tsuu4d480mfStpq8a3a QoayZ7/n6Yu1IXxryhEzO7XBQXiG4FWF1qzb9kwczOzJDrKtYaN3i2dBFHQ7BOxfjIuh cWRLg062CssZduQwOZkkx972Auxcfq+DSVmmGg1dJPwLkL06/zIb0iksV7m4FCF0x/22 rzRmQaGC2lrFy1dQeDgKWe3hfz8moT5Dwds4SLNTkcF8OzObpTlYoLAE5KmPuyinA8J4 UTCnOxurynFARJ8EQTKUur1Q0h6KIXnPEI8bQe+E5p/FqNL25x7zuG1VnsYnEH9eue5N /Z7w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nIUqd9gI; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6fd093e1348si30044496d6.19.2025.06.20.15.20.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Jun 2025 15:20:24 -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=nIUqd9gI; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uSk3e-0000bV-ST; Fri, 20 Jun 2025 18:18:02 -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 1uSfLX-0002cC-As for qemu-devel@nongnu.org; Fri, 20 Jun 2025 13:16:12 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uSfLV-0004bl-Fv for qemu-devel@nongnu.org; Fri, 20 Jun 2025 13:16:10 -0400 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-453608ed113so19666695e9.0 for ; Fri, 20 Jun 2025 10:16:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1750439767; x=1751044567; 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=IJ9HzRGq2YkLK75aks6LUHy4qRCZf2MFv/UyfZ7+gZE=; b=nIUqd9gItaja0Qs4T8kJMXgyFW+HQoGJMApdw3fwqn+G6iz+zxwuWs831RS3GrO83u fPtz64kthxWMpfOtobVbz7Erqy9dtmrkmFHmJkFRv78ZXy8kDittBDd/JbLVvYRCs2rf OiTSrBYV9F5X01bPx0Vls5UzwfmK5qBryGdA8EC9Bd7b7QDUcWtIkYCQZ3eq04hZKoVQ 6YkOirICpeaOitw4tWMuCKcToMArN7N4NrCo1TEfZQCLNgSkwrQ+AB/kMNIp1jDJzvpZ hVOPfcwjKJvo3cHJZFi72t/g1cRBy4rY9CIumClExm7jiSaOIAootdBKe/kClOXLANnH rtvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750439767; x=1751044567; 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=IJ9HzRGq2YkLK75aks6LUHy4qRCZf2MFv/UyfZ7+gZE=; b=wS6hpUTT11xpQWng8zdv1t7srRarff9tDcUTVx94iu7wEN5iBswFqvbm+sE8/JOnBF 9PCTo0BUoe5Zfs1Zfq71C9+LmBBCx0MwgZgEcA391hCRlTVG0rUsjZUNWOcLPwDqd2NB 3qtYbTllsoNAsiy3BHila+gI9ZaCByCmK8o1hOLIFDngxcXaYHRXklwYAg/+eCbE802E EUduBfabiwTc338aJQr7vMZDuebMM6XzKJI/AljKyqFDUksghVlKeMk9rB35F4StgK2g 8071tWyVLNAS5rI4Qun0ws/apIVUphahdfczyyUR2oVCgEXhbHqvjUECP1vutjmIx4K2 OFqQ== X-Gm-Message-State: AOJu0YxkiDmfArK7ASU7Rd2bFMl4NIbG3phx9pLZvXgxaOPOZVoFwOi7 PF86tNHBLWD+CCmliNu4ubIS32WoCh81rLYvYICOyomWrNk8CGodspd8fkRCX9c3noc7Chosx40 +pai/jRs= X-Gm-Gg: ASbGncvw1GELZ+Vz6xz8u6IP0DyADzxS0gDsTKTI3gpVD66NgFS8C84FjrLlbWufLsA EzK1YQc+eeX3/CAC9ukGNb3f7g/zYyuzRToZaFHxP6O26RB+Xr+lo821sAu5MWUVU8ut99tSOi5 KsThjclf/w+WZ0JjJ2bc3PyEQnw6qntANjKMtDRfWK9UF+Y+PQSXgh9q8+JYazvBFeWMT6uM3Y6 KQNZgkiG73oI8bOPr0x/T2tbIOlCP5zsE55rX9Fgq8QBjXo8iaD9Xd1Q/zYAJU9d8phLhOnoWwh QNbFsZNBfnKAp7Lt8SJrycI4zFTJ9FIDsywPBHniDPuoCDLLtNLt4NlTHlw+YzYkv4onn8UsBmo pNZ+QIU14y9aLWNK/erXgxClcsQXgExdL5CT1diP5/R12XgQ= X-Received: by 2002:a05:600c:8b67:b0:453:aca:4d05 with SMTP id 5b1f17b1804b1-45365a04624mr38518265e9.31.1750439765890; Fri, 20 Jun 2025 10:16:05 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-453647071f4sm31494625e9.34.2025.06.20.10.16.04 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Jun 2025 10:16:05 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Alexander Graf , Richard Henderson , Pierrick Bouvier , Peter Maydell , Thomas Huth , Cameron Esfahani , Julian Armistead , Paolo Bonzini , "Edgar E. Iglesias" , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Subject: [RFC PATCH v2 29/48] accel: Factor accel_create_vcpu_thread() out Date: Fri, 20 Jun 2025 19:13:22 +0200 Message-ID: <20250620171342.92678-30-philmd@linaro.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250620171342.92678-1-philmd@linaro.org> References: <20250620171342.92678-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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 Factor accel_create_vcpu_thread() out of system/cpus.c to be able to access accel/ internal definitions. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- include/qemu/accel.h | 2 ++ accel/accel-common.c | 19 +++++++++++++++++++ system/cpus.c | 4 +--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/include/qemu/accel.h b/include/qemu/accel.h index 4ed5f264a88..4e30a633bca 100644 --- a/include/qemu/accel.h +++ b/include/qemu/accel.h @@ -93,6 +93,8 @@ void accel_setup_post(MachineState *ms); */ void accel_cpu_instance_init(CPUState *cpu); +void accel_create_vcpu_thread(AccelState *accel, CPUState *cpu); + /** * accel_cpu_common_realize: * @cpu: The CPU that needs to call accel-specific cpu realization. diff --git a/accel/accel-common.c b/accel/accel-common.c index d1a5f3ca3df..d719917063e 100644 --- a/accel/accel-common.c +++ b/accel/accel-common.c @@ -89,6 +89,25 @@ void accel_cpu_instance_init(CPUState *cpu) } } +void accel_create_vcpu_thread(AccelState *accel, CPUState *cpu) +{ + AccelClass *ac; + + if (!accel) { + accel = current_accel(); + } + ac = ACCEL_GET_CLASS(accel); + + /* accelerators all implement the AccelOpsClass */ + g_assert(ac->ops); + + if (ac->ops->create_vcpu_thread != NULL) { + ac->ops->create_vcpu_thread(cpu); + } else { + g_assert_not_reached(); + } +} + bool accel_cpu_common_realize(CPUState *cpu, Error **errp) { AccelState *accel = current_accel(); diff --git a/system/cpus.c b/system/cpus.c index 4fb764ac880..1721b32fc3f 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -698,9 +698,7 @@ void qemu_init_vcpu(CPUState *cpu) cpu_address_space_init(cpu, 0, "cpu-memory", cpu->memory); } - /* accelerators all implement the AccelOpsClass */ - g_assert(cpus_accel != NULL && cpus_accel->create_vcpu_thread != NULL); - cpus_accel->create_vcpu_thread(cpu); + accel_create_vcpu_thread(NULL, cpu); while (!cpu->created) { qemu_cond_wait(&qemu_cpu_cond, &bql);