From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web12.3669.1608153726585386411 for ; Wed, 16 Dec 2020 13:22:06 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TXfgkvoQ; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1608153725; 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=Z7Dd3PecsDkR2hcK/2bPJmxQWSsnhz1ix/hTddjc+0k=; b=TXfgkvoQD7E9y2GRCNMpxhdRYE1opouCwNXfNhZXfoykcG6Ryh4FDlaeVfwcVdpFGXJiBM lvuij1iN9G/REaSorlJH57yD78O/raBNcCgPWbgZ7x/Lxlx5GFKqvBCP2thUiyByGfsTE4 wfLlHI7y96Ms8I8EGBEUluzMBuPLiAs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-BJZrqRp7Oom_xj7wf29ztQ-1; Wed, 16 Dec 2020 16:22:03 -0500 X-MC-Unique: BJZrqRp7Oom_xj7wf29ztQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 842F651087; Wed, 16 Dec 2020 21:22:02 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-114-152.ams2.redhat.com [10.36.114.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id 862B660CCC; Wed, 16 Dec 2020 21:21:57 +0000 (UTC) From: "Laszlo Ersek" To: devel@edk2.groups.io, virtio-fs@redhat.com, lersek@redhat.com Cc: Ard Biesheuvel , Jordan Justen , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [edk2 PATCH 05/48] OvmfPkg/VirtioFsDxe: add a scatter-gather list data type Date: Wed, 16 Dec 2020 22:10:42 +0100 Message-Id: <20201216211125.19496-6-lersek@redhat.com> In-Reply-To: <20201216211125.19496-1-lersek@redhat.com> References: <20201216211125.19496-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 SW4gcHJlcGFyYXRpb24gZm9yIHRoZSB2YXJpb3VzbHkgc3RydWN0dXJlZCBGVVNFIHJlcXVlc3Qv cmVzcG9uc2UKZXhjaGFuZ2VzIHRoYXQgdmlydGlvLWZzIHVzZXMsIGludHJvZHVjZSBhIHNjYXR0 ZXItZ2F0aGVyIGxpc3QgZGF0YSB0eXBlLgpUaGlzIHdpbGwgbGV0IHVzIGV4cHJlc3MgRlVTRSBy ZXF1ZXN0LXJlc3BvbnNlIHBhaXJzIGZsZXhpYmx5LgoKQWRkIGEgZnVuY3Rpb24gZm9yIHZhbGlk YXRpbmcgd2hldGhlciBhIChyZXF1ZXN0IGJ1ZmZlciBsaXN0LCByZXNwb25zZQpidWZmZXIgbGlz dCkgcGFpciBpcyB3ZWxsLWZvcm1lZCwgYW5kIHN1cHBvcnRlZCBieSB0aGUgVmlydGlvIEZpbGVz eXN0ZW0KZGV2aWNlJ3MgcXVldWUgZGVwdGguCgpBZGQgYW5vdGhlciBmdW5jdGlvbiBmb3IgbWFw cGluZyBhbmQgc3VibWl0dGluZyBhIHZhbGlkYXRlZCBwYWlyIG9mCnN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ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVxdWVzdC1yZXNwb25zZSBleGNo YW5nZSwgZXhwcmVzc2VkIHZpYQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFJl cXVlc3RTZ0xpc3QgYW5kIFJlc3BvbnNlU2dMaXN0LCB3aWxsIGJlDQorICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgc3VibWl0dGVkIHRvLg0KKw0KKyAgQHBhcmFtW2luLG91dF0gUmVx dWVzdFNnTGlzdCAgIFRoZSBzY2F0dGVyLWdhdGhlciBsaXN0IHRoYXQgZGVzY3JpYmVzIHRoZQ0K KyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlcXVlc3QgcGFydCBvZiB0aGUgZXhj aGFuZ2UgLS0gdGhlIGJ1ZmZlcnMNCisgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0 aGF0IHNob3VsZCBiZSBzZW50IHRvIHRoZSBWaXJ0aW8gRmlsZXN5c3RlbQ0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIGRldmljZSBpbiB0aGUgdmlydGlvIHRyYW5zZmVyLg0KKw0K KyAgQHBhcmFtW2luLG91dF0gUmVzcG9uc2VTZ0xpc3QgIFRoZSBzY2F0dGVyLWdhdGhlciBsaXN0 IHRoYXQgZGVzY3JpYmVzIHRoZQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJl c3BvbnNlIHBhcnQgb2YgdGhlIGV4Y2hhbmdlIC0tIHRoZSBidWZmZXJzDQorICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgdGhhdCB0aGUgVmlydGlvIEZpbGVzeXN0ZW0gZGV2aWNlIHNo b3VsZA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBvcHVsYXRlIGluIHRoZSB2 aXJ0aW8gdHJhbnNmZXIuIE1heSBiZSBOVUxMDQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgaWYgdGhlIGV4Y2hhbmdlIHdpdGggdGhlIFZpcnRpbyBGaWxlc3lzdGVtDQorICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgZGV2aWNlIGNvbnNpc3RzIG9mIGEgcmVxdWVzdCBv bmx5LCB3aXRoIHRoZQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNl IHBhcnQgb21pdHRlZCBhbHRvZ2V0aGVyLg0KKw0KKyAgQHJldHZhbCBFRklfU1VDQ0VTUyAgICAg ICAgICAgIFJlcXVlc3RTZ0xpc3QgYW5kIFJlc3BvbnNlU2dMaXN0IGhhdmUgYmVlbg0KKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhbGlkYXRlZCwgb3V0cHV0IGZpZWxkcyBoYXZl IGJlZW4gc2V0Lg0KKw0KKyAgQHJldHZhbCBFRklfSU5WQUxJRF9QQVJBTUVURVIgIFJlcXVlc3RT Z0xpc3QgaXMgTlVMTC4NCisNCisgIEByZXR2YWwgRUZJX0lOVkFMSURfUEFSQU1FVEVSICBPbiBp bnB1dCwgYQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZJUlRJT19GU19TQ0FU VEVSX0dBVEhFUl9MSVNULklvVmVjIGZpZWxkIGlzDQorICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgTlVMTCwgb3IgYQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFZJ UlRJT19GU19TQ0FUVEVSX0dBVEhFUl9MSVNULk51bVZlYyBmaWVsZCBpcw0KKyAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgIHplcm8uDQorDQorICBAcmV0dmFsIEVGSV9JTlZBTElEX1BB UkFNRVRFUiAgT24gaW5wdXQsIGEgVklSVElPX0ZTX0lPX1ZFQ1RPUi5CdWZmZXIgZmllbGQNCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpcyBOVUxMLCBvciBhIFZJUlRJT19GU19J T19WRUNUT1IuU2l6ZSBmaWVsZA0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlz IHplcm8uDQorDQorICBAcmV0dmFsIEVGSV9VTlNVUFBPUlRFRCAgICAgICAgKFJlcXVlc3RTZ0xp c3QtPk51bVZlYyArDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgUmVzcG9uc2VT Z0xpc3QtPk51bVZlYykgZXhjZWVkcw0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg IFZpcnRpb0ZzLT5RdWV1ZVNpemUsIG1lYW5pbmcgdGhhdCB0aGUgdG90YWwNCisgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICBsaXN0IG9mIGJ1ZmZlcnMgY2Fubm90IGJlIHBsYWNlZCBv biB0aGUgdmlydGlvDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcXVldWUgaW4g YSBzaW5nbGUgZGVzY3JpcHRvciBjaGFpbiAod2l0aCBvbmUNCisgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBkZXNjcmlwdG9yIHBlciBidWZmZXIpLg0KKw0KKyAgQHJldHZhbCBFRklf VU5TVVBQT1JURUQgICAgICAgIE9uZSBvZiB0aGUNCisgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICBWSVJUSU9fRlNfU0NBVFRFUl9HQVRIRVJfTElTVC5Ub3RhbFNpemUgZmllbGRzDQor ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd291bGQgZXhjZWVkIE1BWF9VSU5UMzIu DQorKiovDQorRUZJX1NUQVRVUw0KK1ZpcnRpb0ZzU2dMaXN0c1ZhbGlkYXRlICgNCisgIElOICAg ICBWSVJUSU9fRlMgICAgICAgICAgICAgICAgICAgICAqVmlydGlvRnMsDQorICBJTiBPVVQgVklS VElPX0ZTX1NDQVRURVJfR0FUSEVSX0xJU1QgKlJlcXVlc3RTZ0xpc3QsDQorICBJTiBP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isgIGJlZm9yZSBWaXJ0aW9Gc1VuaW5pdCgpIGlz IGNhbGxlZC4NCisNCisgIEBwYXJhbVtpbixvdXRdIFZpcnRpb0ZzICAgICAgICBUaGUgVmlydGlv IEZpbGVzeXN0ZW0gZGV2aWNlIHRoYXQgdGhlDQorICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgcmVxdWVzdC1yZXNwb25zZSBleGNoYW5nZSwgZXhwcmVzc2VkIHZpYQ0KKyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIFJlcXVlc3RTZ0xpc3QgYW5kIFJlc3BvbnNlU2dMaXN0 LCBzaG91bGQgbm93DQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYmUgc3VibWl0 dGVkIHRvLg0KKw0KKyAgQHBhcmFtW2luLG91dF0gUmVxdWVzdFNnTGlzdCAgIFRoZSBzY2F0dGVy LWdhdGhlciBsaXN0IHRoYXQgZGVzY3JpYmVzIHRoZQ0KKyAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgIHJlcXVlc3QgcGFydCBvZiB0aGUgZXhjaGFuZ2UgLS0gdGhlIGJ1ZmZlcnMNCisg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGF0IHNob3VsZCBiZSBzZW50IHRvIHRo ZSBWaXJ0aW8gRmlsZXN5c3RlbQ0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRl dmljZSBpbiB0aGUgdmlydGlvIHRyYW5zZmVyLg0KKw0KKyAgQHBhcmFtW2luLG91dF0gUmVzcG9u c2VTZ0xpc3QgIFRoZSBzY2F0dGVyLWdhdGhlciBsaXN0IHRoYXQgZGVzY3JpYmVzIHRoZQ0KKyAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlc3BvbnNlIHBhcnQgb2YgdGhlIGV4Y2hh bmdlIC0tIHRoZSBidWZmZXJzDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhh dCB0aGUgVmlydGlvIEZpbGVzeXN0ZW0gZGV2aWNlIHNob3VsZA0KKyAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgIHBvcHVsYXRlIGluIHRoZSB2aXJ0aW8gdHJhbnNmZXIuIE1heSBiZSBO VUxMDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgYW5kIG9ubHkgaWYgTlVM TCB3YXMgcGFzc2VkIHRvDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVmlydGlv RnNTZ0xpc3RzVmFsaWRhdGUoKSBhcyBSZXNwb25zZVNnTGlzdC4NCisNCisgIEByZXR2YWwgRUZJ X1NVQ0NFU1MgICAgICAgVHJhbnNmZXIgY29tcGxldGUuIFRoZSBjYWxsZXIgc2hvdWxkIGludmVz dGlnYXRlDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIHRoZSBWSVJUSU9fRlNfSU9fVkVD VE9SLlRyYW5zZmVycmVkIGZpZWxkcyBpbg0KKyAgICAgICAgICAgICAgICAgICAgICAgICAgICBS ZXNwb25zZVNnTGlzdCwgdG8gZW5zdXJlIGNvdmVyYWdlIG9mIHRoZSByZWxldmFudA0KKyAgICAg ICAgICAgICAgICAgICAgICAgICAgICByZXNwb25zZSBidWZmZXJzLiBTdWJzZXF1ZW50bHksIHRo ZSBjYWxsZXIgc2hvdWxkDQorICAgICAgICAgICAgICAgICAgICAgICAgICAgIGludmVzdGlnYXRl IHRoZSBjb250ZW50cyBvZiB0aG9zZSBidWZmZXJzLg0KKw0KKyAgQHJldHZhbCBFRklfREVWSUNF X0VSUk9SICBUaGUgVmlydGlvIEZpbGVzeXN0ZW0gZGV2aWNlIHJlcG9ydGVkIHBvcHVsYXRpbmcN CisgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9yZSByZXNwb25zZSBieXRlcyB0aGFuIFJl c3BvbnNlU2dMaXN0LT5Ub3RhbFNpemUuDQorDQorICBAcmV0dXJuICAgICAgICAgICAgICAgICAg IEVycm9yIGNvZG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0b3IuDQor ICAgICAgLy8NCisgICAgICBTdGF0dXMgPSBWaXJ0aW9NYXBBbGxCeXRlc0luU2hhcmVkQnVmZmVy ICgNCisgICAgICAgICAgICAgICAgIFZpcnRpb0ZzLT5WaXJ0aW8sDQorICAgICAgICAgICAgICAg ICBTZ0xpc3RWaXJ0aW9NYXBPcFtMaXN0SWRdLA0KKyAgICAgICAgICAgICAgICAgSW9WZWMtPkJ1 ZmZlciwNCisgICAgICAgICAgICAgICAgIElvVmVjLT5TaXplLA0KKyAgICAgICAgICAgICAgICAg JklvVmVjLT5NYXBwZWRBZGRyZXNzLA0KKyAgICAgICAgICAgICAgICAgJklvVmVjLT5NYXBwaW5n DQorICAgICAgICAgICAgICAgICApOw0KKyAgICAgIGlmIChFRklfRVJST1IgKFN0YXR1cykpIHsN CisgICAgICAgIGdvdG8gVW5tYXA7DQorICAgICAgfQ0KKyAgICAgIElvVmVjLT5NYXBwZWQgPSBU UlVFOw0KKyAgICB9DQorICB9DQorDQorICAvLw0KKyAgLy8gQ29tcG9zZSB0aGUgZGVzY3JpcHRv ciBjaGFpbi4NCisgIC8vDQorICBWaXJ0aW9QcmVwYXJlICgmVmlydGlvRnMtPlJpbmcsICZJbmRp Y2VzKTsNCisgIGZvciAoTGlzdElkID0gMDsgTGlzdElkIDwgQVJSQVlfU0laRSAoU2dMaXN0UGFy YW0pOyBMaXN0SWQrKykgew0KKyAgICBTZ0xpc3QgPSBTZ0xpc3RQYXJhbVtMaXN0SWRdOw0KKyAg ICBpZiAoU2dMaXN0ID09IE5VTEwpIHsNCisgICAgICBjb250aW51ZTsNCisgICAgfQ0KKyAgICBm b3IgKElvVmVjSWR4ID0gMDsgSW9WZWNJZHggPCBTZ0xpc3QtPk51bVZlYzsgSW9WZWNJZHgrKykg ew0KKyAgICAgIFVJTlQxNiBOZXh0RmxhZzsNCisNCisgICAgICBJb1ZlYyA9ICZTZ0xpc3QtPklv VmVjW0lvVmVjSWR4XTsNCisgICAgICAvLw0KKyAgICA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