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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,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 9DFD4C3A5A1 for ; Thu, 29 Aug 2019 02:48:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79A612173E for ; Thu, 29 Aug 2019 02:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726142AbfH2Cs0 (ORCPT ); Wed, 28 Aug 2019 22:48:26 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:5688 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725993AbfH2Cs0 (ORCPT ); Wed, 28 Aug 2019 22:48:26 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 7CF3ED78A60A72B8A524; Thu, 29 Aug 2019 10:48:22 +0800 (CST) Received: from [127.0.0.1] (10.184.12.158) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.439.0; Thu, 29 Aug 2019 10:48:15 +0800 Subject: Re: [PATCH] KVM: arm/arm64: vgic: Allow more than 256 vcpus for KVM_IRQ_LINE To: Marc Zyngier , Peter Maydell , James Morse , Julien Thierry , Suzuki K Poulose CC: , , , , Eric Auger References: <20190818140710.23920-1-maz@kernel.org> From: Zenghui Yu Message-ID: <47328538-01e6-3152-01f1-ae9c923f628f@huawei.com> Date: Thu, 29 Aug 2019 10:46:57 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Thunderbird/64.0 MIME-Version: 1.0 In-Reply-To: <20190818140710.23920-1-maz@kernel.org> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.184.12.158] X-CFilter-Loop: Reflected Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi Marc, On 2019/8/18 22:07, Marc Zyngier wrote: > While parts of the VGIC support a large number of vcpus (we > bravely allow up to 512), other parts are more limited. > > One of these limits is visible in the KVM_IRQ_LINE ioctl, which > only allows 256 vcpus to be signalled when using the CPU or PPI > types. Unfortunately, we've cornered ourselves badly by allocating > all the bits in the irq field. > > Since the irq_type subfield (8 bit wide) is currently only taking > the values 0, 1 and 2 (and we have been careful not to allow anything > else), let's reduce this field to only 4 bits, and allocate the > remaining 4 bits to a vcpu2_index, which acts as a multiplier: > > vcpu_id = 256 * vcpu2_index + vcpu_index > > With that, and a new capability (KVM_CAP_ARM_IRQ_LINE_LAYOUT_2) > allowing this to be discovered, it becomes possible to inject > PPIs to up to 4096 vcpus. But please just don't. > > Reported-by: Zenghui Yu > Signed-off-by: Marc Zyngier > --- Reviewed-by: Zenghui Yu And tested together with Eric's patches (KVM+QEMU). Thanks, zenghui