From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF746C433E0 for ; Thu, 28 Jan 2021 13:04:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B43F64D9A for ; Thu, 28 Jan 2021 13:04:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2B43F64D9A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:55244 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l56xy-0000Cn-UB for qemu-devel@archiver.kernel.org; Thu, 28 Jan 2021 08:04:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48334) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l56xO-0008Ba-3C for qemu-devel@nongnu.org; Thu, 28 Jan 2021 08:03:30 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:55263) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1l56xI-0007ir-MK for qemu-devel@nongnu.org; Thu, 28 Jan 2021 08:03:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611839002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k66rmxWzoB9VS5hRWuT7meE8+fUD4m85+SfYXUPt3VY=; b=C3StAk9AzYR4taeykDkbfCwCDD404QvzTu+Gs9CbKnqNZdX8q9W+9mMxHUOG4eKh8TMt5g VaD1CoQXUEo4w9YunZnyNqu9oXMwwAtclebZeucyChzUOMOhMAN5XD05XhycOGrk33AhDn oaYHXFKdFHIBoxGgo1/mG89+jqJfchY= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-240-KHdRwyCQOxacKRUb8ZPJBQ-1; Thu, 28 Jan 2021 08:03:18 -0500 X-MC-Unique: KHdRwyCQOxacKRUb8ZPJBQ-1 Received: by mail-ed1-f71.google.com with SMTP id t9so3144394edd.3 for ; Thu, 28 Jan 2021 05:03:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=k66rmxWzoB9VS5hRWuT7meE8+fUD4m85+SfYXUPt3VY=; b=oW6OxZutYD0RTa/bhNK50FF+LYHpSsLsq8ADRAGBzF4RC1ygts5awEkU0WcA7ccIG3 HGDaYazJvP14tmkxPC+LGFmyhgHffMz1290AAZrkfmTkymvSlBTrvv8+iel3PHDtF1p1 n7fh4Z87z7fuZGJo448rbzJd9HpARSUhXEZlqPx5CYMmCdxRvu2cB1Q36GLaUoz/7Rvc z3JfvTPOAvREBZvV2BaVoFcRx1aDHO9mEidHy0izYboarXQYopciZe/mCBub18UJ+gV4 nw/pb0DBdhD08bSJNeZvz+88snTgn+LtJdgmVKbu3QKe8n9b6zbc1amdpYdr2A+fdoF6 0n3A== X-Gm-Message-State: AOAM531QzEml16s7ErFKjKz4SfB+I1x65gTBdWHo1BZW73zoDjil2QLR Q9Mk3y6QObceja5H0rvTxMfoPDDizc1Hxq51cj7D4alAoNjn6MZSZ1eeRsrhs4fFa/hD6XRZYm5 Vzyo37sQlPoqBV6kaKG6ck/4SpVWaoRJv7Y8QvrXDxgkOruGMpFtYw5PqOQc2BDQS X-Received: by 2002:a05:6402:1155:: with SMTP id g21mr13919116edw.279.1611838997022; Thu, 28 Jan 2021 05:03:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyh1bPquhGZcaRT5/z8m+A0TnqPyyYJcz0h8jFWQW94HMZy+g32kibIbclQprrkVoJ0r8pTFw== X-Received: by 2002:a05:6402:1155:: with SMTP id g21mr13919066edw.279.1611838996732; Thu, 28 Jan 2021 05:03:16 -0800 (PST) Received: from [192.168.1.36] (13.red-83-57-169.dynamicip.rima-tde.net. [83.57.169.13]) by smtp.gmail.com with ESMTPSA id b26sm3028944eds.48.2021.01.28.05.03.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Jan 2021 05:03:15 -0800 (PST) Subject: Re: [PATCH v14 18/22] accel: introduce AccelCPUClass extending CPUClass To: Claudio Fontana , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Peter Maydell , Markus Armbruster References: <20210128092814.8676-1-cfontana@suse.de> <20210128092814.8676-19-cfontana@suse.de> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: <64d8385c-db22-b647-2402-3840b0e0e9b5@redhat.com> Date: Thu, 28 Jan 2021 14:03:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210128092814.8676-19-cfontana@suse.de> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=63.128.21.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -30 X-Spam_score: -3.1 X-Spam_bar: --- X-Spam_report: (-3.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.252, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Alistair Francis , Roman Bolshakov , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 1/28/21 10:28 AM, Claudio Fontana wrote: > add a new optional interface to CPUClass, > which allows accelerators to extend the CPUClass > with additional accelerator-specific initializations. > > Add the field before tcg_ops, and mark tcg_ops as > needing to be last in the struct until we rework this > further in a later patch. > > Signed-off-by: Claudio Fontana > --- > include/hw/core/accel-cpu.h | 35 +++++++++++++++++++++++++++++ > include/hw/core/cpu.h | 1 + > accel/accel-common.c | 44 +++++++++++++++++++++++++++++++++++++ > MAINTAINERS | 1 + > 4 files changed, 81 insertions(+) > create mode 100644 include/hw/core/accel-cpu.h > > diff --git a/include/hw/core/accel-cpu.h b/include/hw/core/accel-cpu.h > new file mode 100644 > index 0000000000..246b3e2fcb > --- /dev/null > +++ b/include/hw/core/accel-cpu.h > @@ -0,0 +1,35 @@ > +/* > + * Accelerator interface, specializes CPUClass > + * > + * Copyright 2020 SUSE LLC 2020-2021 ;) > + * > + * This work is licensed under the terms of the GNU GPL, version 2 or later. > + * See the COPYING file in the top-level directory. > + */ > + > +#ifndef ACCEL_CPU_H > +#define ACCEL_CPU_H > + > +/* > + * these defines cannot be in cpu.h, because we are using > + * CPU_RESOLVING_TYPE here. > + * Use this header to define your accelerator-specific > + * cpu-specific accelerator interfaces. > + */ > + > +#define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE > +#define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU) > +typedef struct AccelCPUClass AccelCPUClass; > +DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU) > + > +typedef struct AccelCPUClass { > + /*< private >*/ > + ObjectClass parent_class; > + /*< public >*/ > + > + void (*cpu_class_init)(CPUClass *cc); > + void (*cpu_instance_init)(CPUState *cpu); > + void (*cpu_realizefn)(CPUState *cpu, Error **errp); If we want callers to check errp, better have the prototype return a boolean. > +} AccelCPUClass;