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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 89639C18E5B for ; Wed, 25 Mar 2020 08:11:13 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 006BF2070A for ; Wed, 25 Mar 2020 08:11:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 006BF2070A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 76B954A578; Wed, 25 Mar 2020 04:11:12 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U1Hi7taTuf6P; Wed, 25 Mar 2020 04:11:11 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5ACBB4B08E; Wed, 25 Mar 2020 04:11:11 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 0B6A64A578 for ; Wed, 25 Mar 2020 04:11:10 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w8q5iAhZojOC for ; Wed, 25 Mar 2020 04:11:08 -0400 (EDT) Received: from huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 4F9054A4C0 for ; Wed, 25 Mar 2020 04:11:08 -0400 (EDT) Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EA89594B89FE7E0A7589; Wed, 25 Mar 2020 16:11:02 +0800 (CST) Received: from [127.0.0.1] (10.173.222.27) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Wed, 25 Mar 2020 16:10:53 +0800 Subject: Re: [kvm-unit-tests PATCH v7 08/13] arm/arm64: ITS: Device and collection Initialization To: Eric Auger References: <20200320092428.20880-1-eric.auger@redhat.com> <20200320092428.20880-9-eric.auger@redhat.com> From: Zenghui Yu Message-ID: <63f3d8aa-c1e3-f40f-32a1-fb6d22e70541@huawei.com> Date: Wed, 25 Mar 2020 16:10:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.0 MIME-Version: 1.0 In-Reply-To: <20200320092428.20880-9-eric.auger@redhat.com> Content-Language: en-US X-Originating-IP: [10.173.222.27] X-CFilter-Loop: Reflected Cc: kvm@vger.kernel.org, maz@kernel.org, qemu-devel@nongnu.org, qemu-arm@nongnu.org, andre.przywara@arm.com, thuth@redhat.com, kvmarm@lists.cs.columbia.edu, eric.auger.pro@gmail.com X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Eric, On 2020/3/20 17:24, Eric Auger wrote: > Introduce an helper functions to register > - a new device, characterized by its device id and the > max number of event IDs that dimension its ITT (Interrupt > Translation Table). The function allocates the ITT. > > - a new collection, characterized by its ID and the > target processing engine (PE). > > Signed-off-by: Eric Auger > > --- > > v3 -> v4: > - remove unused its_baser variable from its_create_device() > - use get_order() > - device->itt becomes a GVA instead of GPA > > v2 -> v3: > - s/report_abort/assert > > v1 -> v2: > - s/nb_/nr_ > --- > lib/arm64/asm/gic-v3-its.h | 19 +++++++++++++++++++ > lib/arm64/gic-v3-its.c | 38 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 57 insertions(+) > > diff --git a/lib/arm64/asm/gic-v3-its.h b/lib/arm64/asm/gic-v3-its.h > index 4683011..adcb642 100644 > --- a/lib/arm64/asm/gic-v3-its.h > +++ b/lib/arm64/asm/gic-v3-its.h > @@ -31,6 +31,19 @@ struct its_baser { > }; > > #define GITS_BASER_NR_REGS 8 > +#define GITS_MAX_DEVICES 8 > +#define GITS_MAX_COLLECTIONS 8 > + > +struct its_device { > + u32 device_id; /* device ID */ > + u32 nr_ites; /* Max Interrupt Translation Entries */ > + void *itt; /* Interrupt Translation Table GVA */ > +}; > + > +struct its_collection { > + u64 target_address; > + u16 col_id; > +}; > > struct its_data { > void *base; > @@ -39,6 +52,10 @@ struct its_data { > struct its_baser coll_baser; > struct its_cmd_block *cmd_base; > struct its_cmd_block *cmd_write; > + struct its_device devices[GITS_MAX_DEVICES]; > + u32 nr_devices; /* Allocated Devices */ > + struct its_collection collections[GITS_MAX_COLLECTIONS]; > + u32 nr_collections; /* Allocated Collections */ > }; > > extern struct its_data its_data; > @@ -93,5 +110,7 @@ extern void its_parse_typer(void); > extern void its_init(void); > extern int its_baser_lookup(int i, struct its_baser *baser); > extern void its_enable_defaults(void); > +extern struct its_device *its_create_device(u32 dev_id, int nr_ites); > +extern struct its_collection *its_create_collection(u32 col_id, u32 target_pe); Maybe use 'u16 col_id'? Besides, Reviewed-by: Zenghui Yu Thanks _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm