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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB440CA0EDC for ; Fri, 30 Aug 2024 17:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=JRyDJqMXV+qFFTfWr245dqFLmSfgINpUSZp5mggQxBc=; b=U2jZBaQOIRrtuf6UJQqNAJ1tC6 /nJ9EWnP1ZSMg9Ck0yGH4o5/xOlQxv3KBQXiRnXVzOI3gBWI6h7m3eBt13BqGMrU247zTSjuTTS3q qzqmMbjSuQxw4D7rEvMyeuhN0/WTZ5TZyXB7/gM97VrxfmtpQhMC6OXbnk2CbHi3rSu9fln5awKDc ibnWTfpU9MUQQZRoB8Vd5yy+miH7PMm+D9bcyYr5AYmEzdk0TlKpu8AN7SalpsDQsZ/h74uylUcsU SSE8SSw+D6cAGanY7uoGVe/+phLgnNNcENd8iOB3OlrDfO5OvIW4P2DlpAtt9DHqgb1c/PhaGN2vH ZHqyoaUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sk52B-000000077l9-1RHY; Fri, 30 Aug 2024 17:03:39 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sk51F-000000077bg-1ssX for linux-arm-kernel@lists.infradead.org; Fri, 30 Aug 2024 17:02:43 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D6F701063; Fri, 30 Aug 2024 10:03:04 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 188D13F66E; Fri, 30 Aug 2024 10:02:36 -0700 (PDT) Message-ID: <19c91b5f-e615-4198-b9e3-d0d00084d139@arm.com> Date: Fri, 30 Aug 2024 18:02:35 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 1/2] iommu/arm-smmu-v3: Match Stall behaviour for S2 To: Nicolin Chen , Mostafa Saleh Cc: linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arm-kernel@lists.infradead.org, will@kernel.org, joro@8bytes.org, jean-philippe@linaro.org, jgg@ziepe.ca, mshavit@google.com References: <20240830110349.797399-1-smostafa@google.com> <20240830110349.797399-2-smostafa@google.com> From: Robin Murphy Content-Language: en-GB In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240830_100241_562781_C12EEDA5 X-CRM114-Status: GOOD ( 14.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 30/08/2024 5:30 pm, Nicolin Chen wrote: > On Fri, Aug 30, 2024 at 11:03:47AM +0000, Mostafa Saleh wrote: > >> According to the spec (ARM IHI 0070 F.b), in >> "5.5 Fault configuration (A, R, S bits)": >> A STE with stage 2 translation enabled and STE.S2S == 0 is >> considered ILLEGAL if SMMU_IDR0.STALL_MODEL == 0b10. >> >> Also described in the pseudocode “SteIllegal()” >> if STE.Config == '11x' then >> [..] >> if eff_idr0_stall_model == '10' && STE.S2S == '0' then >> // stall_model forcing stall, but S2S == 0 >> return TRUE; >> >> Which means, S2S must be set when stall model is >> "ARM_SMMU_FEAT_STALL_FORCE", but currently the driver ignores that. >> >> Although, the driver can do the minimum and only set S2S for >> “ARM_SMMU_FEAT_STALL_FORCE”, it is more consistent to match S1 >> behaviour, which also sets it for “ARM_SMMU_FEAT_STALL” if the >> master has requested stalls. > > If I read the SteIllegal() correctly, it seems S2S would conflict > against the STE.EATS settings? > > // Check ATS configuration > if ((sec_sid == SS_NonSecure && SMMU_IDR0.ATS == '1') || > (sec_sid == SS_Realm && SMMU_R_IDR0.ATS == '1')) && > STE.Config != 'x00' then > // Needs to be NS/Realm, ATS enabled, and not Bypass > if STE.EATS == '01' && STE.S2S == '1' then > // Full ATS mode > if STE.Config == '11x' || constr_unpred_EATS_S2S then > // if stage 2 enabled or CONSTRAINED UNPREDICTABLE for SMMUv3.0 > return TRUE; > > So, if master->stall_enabled and master->ats_enabled, there would > be a bad STE? Indeed, but as discussed previously, to get there would require either firmware or hardware to bogusly advertise both stall and ATS capabilities for the same device, which we decided is beyond the scope of what's worth trying to reason about. If a nonsensical system leads to obviously blowing up with C_BAD_STE, that's arguably not such a bad thing. Thanks, Robin.