From nobody Fri Apr 14 07:31:43 2023 X-Original-To: freebsd-arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PyT4B1SgKz44hYq for ; Fri, 14 Apr 2023 07:44:42 +0000 (UTC) (envelope-from dsl@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PyT4B12snz3D5r for ; Fri, 14 Apr 2023 07:44:42 +0000 (UTC) (envelope-from dsl@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681458282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=Z3pxvpynFCyv0btDVtvWf5zqnSW5l/Uadw79N1f6Oek=; b=O/zCucC4Dlb1kyFT49wCZNr44wgehC2aFJUq7hGPNuS01O7jnpzBhNWqG3COJSteSNcPqd ggFiewhWG61w9o7EK0gJgdeLBSCvBnTlnSjEB3btEZdXscZjgqu4S8MGG3AZ1JAbpU7HKE vy0BnkK7mN4aD88knPXZt4bN2HVoXXx9HM72wIuxGZ3pJEtyBWM+5X0oty1ze+H4ijveLK ATbWb0paqZKB6EPPHfZVVmFLa5LwveSE/BE1EGasxKScZ03NGTCiFlzGrX2HU1SZh+UgYg gYGXY/bHhv2DRi9llVWMrFVNHkkm3ONagzcyMBlCRmNAmL2/XEyvxDDvjaq0WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681458282; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=Z3pxvpynFCyv0btDVtvWf5zqnSW5l/Uadw79N1f6Oek=; b=xOTqd6kUEEddZjk7m65r3AHaiwH1SkIn9zmZ6sdHfJMMIDOhurclMG+oTEfXZdTxc4WsWr wPrlXbeEqh3Qrnhjrivy0wt5d7R5Z3+a7Tgo0SOy7nFTN4vzzv63R/4sJcuw5SrZEJmM0n viGb99vRA7sCC8TBK1hOWQ6Pc7ew5XfFNghUmpZORrhxt4yKxuKEBOktTSoHU9Wbk06OxD ApQ9AaEc9urSyPaoFvLKSLJDHjlW1QxQNvyDrrR3NyaPKKmilz5J215V5QsUSIkfzvkROb 6lj808wSw+aiz7stIFeM7LQcq2uJmf81iugUmYVHaLRlwavxXvT1NK8MyWwxPQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681458282; a=rsa-sha256; cv=none; b=DpVQKyOrvoYirRmd343iZD6mZcB0jaXZ5VGgyv4jhUsYjEAWkqpvX10K69MQCs7HjB81VB 9jly/Em90gUeVBIIgXz13yEoZJiUDdRF/flFWB9MduCRFvkgwj5EzzSsZgyCpx730xcl2F fs/Ktg1DbTc4ZKlRt0O+uVb1DjJKWRMMYt4LhzZlE1SQVM1+21fa70x+/xulvL+pxL+7sU g8JwuRSSw3cBLyAkN1A5iDAjy6+HDwrh283gXw1+G6VdP7p6QsATggBaVmblK/nGnY/u4Y l5fA9NAu7MPf+DBIFpWDmu8eYYmYRXKyDcBpnD9Mdr7x/Fu7foGCqbyTGyS2TA== Received: from localhost (unknown [193.164.254.100]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: dsl) by smtp.freebsd.org (Postfix) with ESMTPSA id 4PyT494V4Yz13mD for ; Fri, 14 Apr 2023 07:44:41 +0000 (UTC) (envelope-from dsl@FreeBSD.org) User-agent: mu4e 1.6.10; emacs 28.2 From: Dmitry Salychev To: freebsd-arm@freebsd.org Subject: About PHYS_TO_DMAP Date: Fri, 14 Apr 2023 09:31:43 +0200 Message-ID: <86ildyucuv.fsf@peasant.tower.home> List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 Content-Type: text/plain X-ThisMailContainsUnwantedMimeParts: N Hi, I'm struggling to understand which KVA will be returned by PHYS_TO_DMAP on arm64. For example, if I'll create a DMA tag this way: bus_dma_tag_create( bus_get_dma_tag(dev), sc->buf_align, 0, /* alignment, boundary */ DMAP_MAX_PHYSADDR, /* low restricted addr */ DMAP_MIN_PHYSADDR, /* high restricted addr */ NULL, NULL, /* filter, filterarg */ BUF_SIZE, 1, /* maxsize, nsegments */ BUF_SIZE, 0, /* maxsegsize, flags */ NULL, NULL, /* lockfunc, lockarg */ &dmat); in order to restrict any physical addresses but a window defined by DMAP_MIN_PHYSADDR and DMAP_MAX_PHYSADDR. Later on when I'll be mapping my mbuf (BUF_SIZE) with bus_dmamap_load_mbuf_sg(dmat, dmap, m, &segs, &nsegs, BUS_DMA_NOWAIT); I expect that m->m_data == PHYS_TO_DMAP(segs[0].ds_addr) but it isn't true. Could somebody explain what exactly is returned by PHYS_TO_DMAP in this case and whether it's possible to translate physical address to KVA as fast as possible (O(1) ideally). Regards, Dmitry -- Open source software/hardware enthusiast hackaday.io/dsl | github.com/mcusim | patreon.com/salychev