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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2C08C61DA3 for ; Tue, 21 Feb 2023 08:15:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229697AbjBUIPE (ORCPT ); Tue, 21 Feb 2023 03:15:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232589AbjBUIPC (ORCPT ); Tue, 21 Feb 2023 03:15:02 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BD69C662 for ; Tue, 21 Feb 2023 00:14:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676967254; 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=CMD/lSpj8Q+BWiNprToa/ipg9NB2qcmu1EFE9cZ2W3g=; b=B9dAcKauPhgRy0UtscRJccn7nkXfD1lNGw67rheO6oIuRkoGnXL23vejX4wpvK2Ncecvjg MEFfS1AS940CDlgzpAe+irrjhc44d06XeGRN4OH60phCTrHyJqyukNLYGbUItoBeqDzDRL WmlnP/2pxO+YvYEGWcPgvLaxUdYsskQ= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-347-w6WOUOzpObuiaE8aRtJFKw-1; Tue, 21 Feb 2023 03:14:13 -0500 X-MC-Unique: w6WOUOzpObuiaE8aRtJFKw-1 Received: by mail-ed1-f72.google.com with SMTP id en10-20020a056402528a00b004acbf564d75so4145768edb.5 for ; Tue, 21 Feb 2023 00:14:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CMD/lSpj8Q+BWiNprToa/ipg9NB2qcmu1EFE9cZ2W3g=; b=2k9toCDVl4XM6/ZOf/IHdiWCbHdX5IHOCdgHQhfVfxkc/WDu/e/JKHpeJxOK6ozrMK 0xoL0z/99ICSDBr1AxhQQRQ4eRUT5JFG0cyiZWNbjSeZW8kQKqiMSZco6YMzYtLFg40M FefjO7YtXLyEValbchqMJtjyluWX1s3NX03hRNeAbaH9o8Zu32xGSYQ+7r5CLwTIL+Cs S5h2Eg0Ze3gbIImuGeyg+eRU7UzWXf9D2yVU0NwbcZy18nGKN+wtv/Sk2/3sd7ViTGhS gFLRmfXHb3jRfpFQvJ90l0nFP3T/qxNPph4teQ7yno6Tkdw3vSnRx2WQBC9lAGlvKPuM GpZw== X-Gm-Message-State: AO0yUKXCVNUmfvhE6MgG/HIuXoCBYxnvFsnnQFyLZFGmGpxikIDu/3pW XUth1MP0ikwWss/87VDkeQgSyfRQq2Cj6u2CGHDAgiDOB4Jd70caFX1s36bwjla+k0tPxUB0v1w Zq94C76J+PEuZyvmglFOnNRhW X-Received: by 2002:a17:907:2cc5:b0:8ae:e724:ea15 with SMTP id hg5-20020a1709072cc500b008aee724ea15mr14369740ejc.76.1676967252331; Tue, 21 Feb 2023 00:14:12 -0800 (PST) X-Google-Smtp-Source: AK7set9AS5QbQlqtrVyvZDghkkGcXTp+zHcc9xFk+Kvirqcn35qFg8g54l0y9vHodt2+vSxdFaPeOQ== X-Received: by 2002:a17:907:2cc5:b0:8ae:e724:ea15 with SMTP id hg5-20020a1709072cc500b008aee724ea15mr14369720ejc.76.1676967252017; Tue, 21 Feb 2023 00:14:12 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id lf13-20020a170906ae4d00b008b12c318622sm6855117ejb.29.2023.02.21.00.14.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Feb 2023 00:14:11 -0800 (PST) Message-ID: <3f16a8e1-21d9-808e-aa1a-4f1d6f6f291b@redhat.com> Date: Tue, 21 Feb 2023 09:14:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Content-Language: en-US To: maobibo , Tianrui Zhao Cc: Huacai Chen , WANG Xuerui , Greg Kroah-Hartman , loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Jens Axboe , Mark Brown , Alex Deucher , Oliver Upton References: <20230220065735.1282809-1-zhaotianrui@loongson.cn> <20230220065735.1282809-3-zhaotianrui@loongson.cn> <0fa9c062-d3fc-61e5-4d54-6bc29f7c64cf@loongson.cn> From: Paolo Bonzini Subject: Re: [PATCH v2 02/29] LoongArch: KVM: Implement kvm module related interface In-Reply-To: <0fa9c062-d3fc-61e5-4d54-6bc29f7c64cf@loongson.cn> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/21/23 07:59, maobibo wrote: >> Also, why does the world switch code need a copy? > There will be problem in world switch code if there is page fault reenter, > since pgd register is shared between root kernel and kvm hypervisor. > World switch entry need be unmapped area, cannot be tlb mapped area. So if I understand correctly the processor is in direct address translation mode until the "csrwr t0, LOONGARCH_CSR_CRMD" instruction. Where does it leave paged mode? Can you please also add comments to kvm_vector_entry explaining the processor state after a VZ exception entry (interrupts, paging, ...)? Paolo