Warren Buffett's Berkshire Hathaway bought about 121 million shares of HP

The purchase came in at more than $4.2 billion.

The company's stock gained about 10 percent on the back of the purchase.